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