A,B = map(int,input().split()) N = A.bit_length() M = B.bit_length() bit1 = [0] * 30 bit2 = [0] * 30 for i in range(N): if A & (1 << i): bit1[i] = 1 for i in range(M): if B & (1 << i): bit2[i] = 1 cnt = 0 for i in range(30): 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))