a, b, c = map(int, input().split()) shot_b = b - max(a, c) shot_ac = abs(a - c) ans = min(shot_b, shot_ac) print(ans)