a = list(input()) b = [] b.append(int(a[0])) b.append(int(a[1])) b.append(int(a[2])) print(max(b) - min(b))