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