A,B = map(int,input().split()) bit1 = [0] * 32 bit2 = [0] * 32 for i in range(32): if A & (1 << i): bit1[i] = 1 for i in range(32): if B & (1 << i): bit2[i] = 1 cnt = 0 for i in range(31,-1,-1): if bit1[i] == 1 and bit2[i] == 0: print(0) exit() if bit1[i] == 0 and bit2[i] == 1: cnt += 1 print(pow(2, cnt-1))