a, b = map(int, input().split())

ans = 1
for i in range(66):
    if (a & (1<<i)) and not(b & (1<<i)):
        ans = 0
    if not(a & (1<<i)) and (b & (1<<i)):
        ans *= 2

if ans == 1:
    ans *= 2
print(int(ans/2))