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