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