Gx, Gy = map(int, input().split()) if Gx == 0 or Gy == 0: print(1) # Rook 1手 elif abs(Gx) == abs(Gy): print(1) # Bishop 1手 elif (Gx + Gy) % 2 == 0: print(2) # Bishop 2手で可能 else: print(2) # Rook 2手が最小