x,y,d = map(int, input().split()) if (d > x): res = (d - x) if (res > y): print (0) else: print (y - res + 1) else: print (min(y + 1, d + 1))