a,b=map(int,input().split()) if abs(a)==abs(b) or a==0 or b==0: print(1) elif a==0 and b==0: print(0) else: print(2)