A,B=map(int,input().split()) if A|B != B: print(0) else: print(2**((A&B).bit_count()))