x,y,d = map(int,input().split()) ''' if d <= x and d <= y: print(d+1) exit() ''' l = max(0,d-x) r = min(d,y) print(max(0,r-l+1))