#include //#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) template inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); } template inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); } #define int long long const int INF = (1LL << 60); //const int MOD = 1e9 + 7; vector dx = { 0,1 }; vector dy = { 1,0 }; signed main() { int gx,gy; cin >> gx >> gy; if (gx == 0 && gy == 0){ cout << 0 << endl; return 0; }else if (gx == 0 || gy == 0){ cout << 1 << endl; return 0; }else if (abs(gx) == abs(gy)){ cout << 1 << endl; return 0; }else{ cout << 2 << endl; return 0; } }