a, b = map(int, input().split()) if a & b != a: print(0) else: print(2 ** bin(a & b).count("1"))