abc = input() abc_list = [letter for letter in abc] abc_list.sort() ans = int(abc_list[2]) - int(abc_list[0]) print(ans)