#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 rook_moves = 0, bishop_moves = 1e9; if (gx == 0 || gy == 0) { rook_moves = 1; } else { rook_moves = 2; } if ((gx + gy) % 2 == 0) { if (gx == gy || gx == -gy) { bishop_moves = 1; } else { bishop_moves = 2; } } cout << min(rook_moves, bishop_moves) << '\n'; return 0; }