x, y = [int(x) for x in input().split()] res = -1 if x == y: res = 0 elif y == 0: res = 1 elif x == 0: res = 2 elif x == -y: res = 3 print(res)