S = list(input())
for i in range(3):
    S[i]=int(S[i])
print(max(S)-min(S))