A, B = map(int,input().split()) if(A == B): print(1) exit() res = 1 for i in range(33): if((A>>i)&1 and not((B>>i)&1)): print(0) exit(0) if(not((A>>i)&1) and (B>>i)&1): res *= 2 res //= 2 print(res)