#include int main(){ int x, y; std::cin >> x >> y; if((x | y) == 0) puts("0"); else puts((std::abs(x) == std::abs(y) || x * y == 0) ? "1" : "2"); }