x, y = tuple(map(int, input().split())) ans = 2 if x == y == 0: ans = 0 elif abs(x) == abs(y) or x == 0 or y == 0: ans = 1 print(ans)