def distance(inp): if inp >= 0: return inp else: return -1 * inp x, y = map(int, input().split()) if (x == 0) and (y == 0): print(0) elif (x == 0) or (y == 0): print(1) elif distance(x) == distance(y): print(1) else: print(2)