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(x + 1, y + 1, d + 1))