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