import sys if sys.platform =='ios': import clipboard a=clipboard.get() a = a.split('\n') text = '\n'.join(a) with open('input_file.txt','w') as f: f.write(text) sys.stdin = open('input_file.txt') sys.setrecursionlimit(410000000) stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline().strip() nm = lambda: map(int,input().split()) na_1 = lambda: list(map(lambda x:int(x)*(-1), stdin.readline().split())) na_2 = lambda: list(map(lambda x:int(x)-1, stdin.readline().split())) rnage=range rnge=range rage = range rnag=range x,y,d = nm() x,y = max(x,y),min(x,y) if 0 <= d <= y: print(d+1) elif y <= d <= x: print(y+1) elif x <= d <= x+y: print(x+1) else: print(0)