#include using namespace std; int main() { int a; cin >>a; int b =a/100; int c=a/10-b*10; int d=a-b*100-c*10; int e=min(b, (min(c, d))); int f=max(b, (max(c, d))); cout << f-b; }