#include using namespace std; int main() { int x, y; cin >> x >> y; int ans = 2; if (x == 0 || y == 0 || x + y == 0 || x - y == 0) { ans = 1; } if (x == 0 && y == 0) ans = 0; cout << ans << endl; return 0; }