#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; const ll INF = 1e18; const ll MOD = 998244353; const ll MODD = 1e9 + 7; long long modpow(long long x, long long n); long long modinv(long long a, long long m); bool palindrome(const string& s); int main(){ ll x,y = 0; cin >> x >> y; if(x == 0 && y == 0){ cout << "0" << endl; } else if(x == 0 && y != 0){ cout << "1" << endl; } else if(y == 0 && x != 0){ cout << "1" << endl; } else if(abs(x) == abs(y)){ cout << "1" << endl; } else { cout << "2" << endl; } return 0; }