A,B,S = map(int,raw_input().split()) a = abs(A-S); b = abs(B-S) print S + (b + abs(A-1) if a > b else a)