#include #include using namespace std; int main() { long long gx, gy; cin >> gx >> gy; int rook_moves, bishop_moves = 1e9; // Rook logic if (gx == 0 || gy == 0) { rook_moves = 1; } else { rook_moves = 2; } // Bishop logic if ((gx + gy) % 2 == 0) { if (gx == gy || gx == -gy) { bishop_moves = 1; } else { bishop_moves = 2; } } cout << min(rook_moves, bishop_moves) << endl; return 0; }