abc = list(input()) abc = list(map(int,abc)) print(max(abc)-min(abc))