gx, gy = map(int, input().split()) if gx==0 and gy==0: print(0) elif gx == gy or (gx == -gy and gy > 0): print(1) else: print(2)