import sys A,B = list(map(int,input().split())) count = 0 for i in range(32): mask = 1 << i if A & mask and B & mask == 0: print(0) exit() if A & mask == 0 and B & mask == 1: count += 1 if A == B: print(1) else: print(2 ** (count-1))