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