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