def popcount(n): return bin(n).count("1") A, B = map(int, input().split()) ans = 0 if A & B == A: NOT_A = 0xffffffff ^ A pc = popcount(NOT_A & B) ans = (2**pc) // 2 print(ans)