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