x, y = map(int, input().split()) ans = 0 if x == y == 0 else 1 if abs(x) == abs(y) or x * y == 0 else 2 print(ans)