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