#include using namespace std; int main() { int k, a, b, c,m,n; cin >> k; c = k % 10; k /= 10; b = k % 10; k /= 10; a = k; m = max(max(a, b),c); n = min(min(a, b),c); cout << m - n << endl; return 0; }