A, B, C = map(int, input().split()) if A < B and C < B: print(B - max(A, C)) elif A > B and C > B: print(min(A, C) - B) else: print(B)