x, y = map(int, input().split()) print(min(int(abs(x) != 0) + int(abs(y) != 0), 2 - int(abs(x) == abs(y)) - int(x == 0 and y == 0)))