A,B = map(int,input().split()) if A==0: print(1) exit() if A>B: print(0) exit() ans = 1 less = False for a,b in (zip(bin(A)[2:],bin(B)[2:])): if a==b: continue if a=='1' and b=='0': print(0) exit() if less: ans *= 2 else: less = True print(ans)