from sys import stdin def main(): input = lambda: stdin.readline()[:-1] ABC = input() a, b, c = sorted(ABC) print(int(c) - int(a)) main()