x, y, d = io.read("*n", "*n", "*n") xmax = math.min(d, x) xmin = math.max(0, d - y) print(math.max(0, xmax - xmin + 1))