#131 manhattann distance x,y,d=(int(i) for i in input().split()) if x>y: m=y else: m=x if m*2d: print(d) else: m*=2 print(m-d+1)