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