Gx,Gy=(abs(int(x)) for x in input().split()) if Gx*Gy==0: if Gx==Gy==0: print(0) else: print(1) elif Gx == Gy: print(1) else: print(2)