x, y, d = map(int, input().split()) l = max(0, d-y) r = min(x, d) ans = max(0, r-l+1) print(ans)