a,b = map(int, input().split()) if a&b != a: print(0) elif a == b: print(1) else: print(pow(2,str(bin(a^b)).count('1')-1))