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