x,y,d = map(int,input().split()) u = min(x,d) l = max(0,d-y) print(max(0,u-l+1))