import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines x,y,d = map(int,read().split()) x_min = max(0, d-y) x_max = min(x, d) answer = x_max - x_min + 1 if answer < 0: answer = 0 print(answer)