import sys input = lambda: sys.stdin.readline().rstrip() def solve(): a, b = map(int, input().split()) ans = 1 ok = True for i in range(0, 30): if((a & (1 << i)) & (b & (1 << i))): ans *= 2 if((a & (1 << i)) == 1 and (b & (1 << i)) == 0): ok = False if(ok): print(ans) else: print(0) t = 1 # t = int(input()) for _ in range(t): solve()