a,b=map(int,input().split()) c=a|b if c!=b: print(0) exit() result=1 for k in range(10): if (a>>k)&1: result*=2 print(result)