A, B = map(int, input().split()) binA = format(A, 'b') binB = format(B, 'b') if len(binA)<=len(binB): binA = '0'*(len(binB)-len(binA))+binA else: binB = '0'*(len(binA)-len(binB))+binB c1, c2, c3, c4 = 0, 0, 0, 0 for binA_i, binB_i in zip(binA, binB): if binA_i=='1' and binB_i=='1': c1 += 1 elif binA_i=='1' and binB_i=='0': c2 += 1 elif binA_i=='0' and binB_i=='1': c3 += 1 elif binA_i=='0' and binB_i=='0': c4 += 1 if c2>0: print(0) elif c3==0: print(1) else: print(2**(c3-1))