#include using namespace std; int main(){ int x, y; cin >> x >> y; int rook_moves = 0; if (x == 0 && y == 0) { rook_moves = 0; } else if (x == 0 || y == 0) { rook_moves = 1; } else { rook_moves = 2; } int bishop_moves = 1e9; if (x == 0 && y == 0) { bishop_moves = 0; } else if (x == y || x == -y) { bishop_moves = 1; } else if ((x + y) % 2 == 0) { bishop_moves = 2; } cout << min(rook_moves, bishop_moves) << endl; }