#include using namespace std; using ll = long long; #define fi first #define se second #define all(a) a.begin(),a.end() int main(){ string s; cin >> s; vector a(3); for(int i=0; i<3; ++i){ a[i]=s[i]-'0'; } sort(all(a)); cout << a[2]-a[0] << endl; return 0; }