#include using namespace std; int main(){ // 入力 int x, y; cin >> x >> y; // 判定して答えを出力 if(x == 0 && y == 0){ cout << 0 << endl; } else if(x == y || x == -y || x == 0 || y == 0) { cout << 1 << endl; } else{ cout << 2 << endl; } }