Gx, Gy = map(float, input().split()) if Gx == Gy == 0: print(0) elif abs(Gx) == abs(Gy) or Gx == 0 or Gy == 0: print(1) else: print(2)