#include #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { char c[3]; int mx = 0; int mn = 10; rep(i, 3) { cin >> c[i]; int a = c[i] - '0'; mx = max(a, mx); mn = min(a, mn); } cout << mx - mn << endl; return 0; }