#include //#include using namespace std; //using namespace atcoder; using ll = long long; //using mint = modint998244353; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); int gx, gy; cin >> gx >> gy; if (gx == 0 && gy == 0) cout << 0 << endl; else if (abs(gx) == abs(gy)) cout << 1 << endl; else if (gx == 0 || gy == 0) cout << 1 << endl; else cout << 2 << endl; return 0; }