#include using namespace std; int main() { long long Gx, Gy; cin >> Gx >> Gy; int rook_steps = (Gx == 0 || Gy == 0) ? 1 : 2; int bishop_steps; if (Gx == 0 && Gy == 0) bishop_steps = 0; else if (abs(Gx) == abs(Gy)) bishop_steps = 1; else if ((Gx + Gy) % 2 == 0) bishop_steps = 2; else bishop_steps = 1e9; // không thể đến được cout << min(rook_steps, bishop_steps) << endl; return 0; }