#include #include #include #include #include #include #include #include #include #include using namespace std; int main(){ int a, b, c; string s; cin >> s; a = s[0]; b = s[1]; c = s[2]; cout << max(a, max(b, c)) - min(a, min(b, c)) << endl; }