abc = int(input()) a = abc // 100 b = (abc - a*100) // 10 c = abc - a*100 - b*10 M = max(max(a, b), c) m = min(min(a, b), c) print (M-m)