# include # include # include using namespace std; int main() { int gx, gy; cin >> gx >> gy; int ans = 0; if (gx == 0 && gy == 0) { ans = 0; } else if (gx == gy || gx==0 || gy == 0) { ans = 1; } else { ans = 2; } cout << ans << endl; }