A, C = list(map(int, input().split())) bA = [] bC = [] while True: if A == 0 and C == 0: break else: bC.append(C % 2) bA.append(A % 2) A //= 2 C //= 2 bB = [(ba==1 and bc==0) or (ba==0 and bc==1) for ba, bc in zip(bA, bC)] tmp = 1 B = 0 for bb in bB: if bb: B += tmp tmp *= 2 print(B)