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