#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i) #define all(a) (a).begin(),(a).end() int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); ll Gx, Gy; cin >> Gx >> Gy; if (Gx == 0 && Gy == 0) cout << 0 << '\n'; else if (Gx == 0 || Gy == 0 || abs(Gx) == abs(Gy)) cout << 1 << '\n'; else cout << 2 << '\n'; }