gx,gy=map(int,input().split()) ans=(gx!=0)+(gy!=0) if gx%2==gy%2: if abs(gx)==abs(gy): ans=min(ans,1) print(ans)