#include #include using namespace std; int main (){ int Gx,Gy; cin >> Gx >> Gy; int rook_moves; if (Gx == 0 && Gy == 0){ rook_moves = 0; }else if (Gx == 0 || Gy == 0){ rook_moves = 1; }else{ rook_moves = 2; } int bishop_moves; if (Gx == 0 && Gy == 0){ bishop_moves = 0; }else if ((Gx + Gy) %2 != 0){ bishop_moves = 1e9; }else if (Gx == Gy || Gx == -Gy){ bishop_moves = 1; }else{ bishop_moves = 2; } int ans = min(rook_moves,bishop_moves); cout << ans << endl; return 0; }