A = list(map(int, list(input()))) A.sort() print(A[2] - A[0])