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