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