// Online compiler C++ #include using namespace std ; #define nl "\n" #define int long long using vi = vector ; void solve() { int x , y ; cin >> x >> y ; if( !x && !y ) cout << 0 << nl ; else if( abs(x) == abs(y) || !x || !y ) cout << 1 << nl ; // All 4 dir-bishops else cout << 2 << nl ; // dia + rook. } signed main() { int t = 1 ; // cin >> t ; while( t-- ) { solve() ; } return 0 ; }