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