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