a,b=map(int,input().split()) t=bin(a).count('1') if b&a!=a: print(0) else: print(2**t)