a, b = map(int, input().split()) print(sum(a | x == b for x in range(256)))