x, y, d = gets.split.map &:to_i a = [x, d].min b = [0, d - y].max puts [0, a - b + 1].max