#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include<bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); string s; cin>>s; vector<int> A(3); rep(i,3) A[i]=s[i]-'0'; sort(ALL(A)); cout<<A[2]-A[0]<<endl; return 0; }