# include # include # include using namespace std; int main() { long long Gx, Gy; cin >> Gx >> Gy; if (Gx == 0 && Gy == 0) { cout << 0 << "\n"; return 0; } int rookMoves = (Gx == 0 || Gy == 0) ? 1 : 2; int bishopMoves = (Gx == Gy || Gx == -Gy) ? 1 : 2; cout << min(rookMoves, bishopMoves) << "\n"; return 0; }