number = input() print(int(max(number)) - int(min(number)))