def get_one_cnts(n):
    one_cnts_dic = []
    for i in range(0,40): 
        if i == 0:
            if n%4 in [1,2]:
                one_cnts_dic.append(1)
            else:
                one_cnts_dic.append(0)
        else:
            cycle = 2**(i+1) 
            if n%cycle in range(cycle//2, cycle, 2):
                one_cnts_dic.append(1)
            else:
                one_cnts_dic.append(0)
    return one_cnts_dic

a,b = map(int, input().split())
a_one_cnts = get_one_cnts(a-1)
b_one_cnts = get_one_cnts(b)
# print(a_one_cnts)
# print(b_one_cnts)
ans = 0
for i in range(40):
    if a_one_cnts[i] ^ b_one_cnts[i]:
        ans += 2**i

print(ans) def get_one_cnts(n):
    one_cnts_dic = []
    for i in range(0,40): 
        if i == 0:
            if n%4 in [1,2]:
                one_cnts_dic.append(1)
            else:
                one_cnts_dic.append(0)
        else:
            cycle = 2**(i+1) 
            if n%cycle in range(cycle//2, cycle, 2):
                one_cnts_dic.append(1)
            else:
                one_cnts_dic.append(0)
    return one_cnts_dic get_one_cnts one_cnts_dic = [] one_cnts_dic [] for i in range(0,40): 
        if i == 0:
            if n%4 in [1,2]:
                one_cnts_dic.append(1)
            else:
                one_cnts_dic.append(0)
        else:
            cycle = 2**(i+1) 
            if n%cycle in range(cycle//2, cycle, 2):
                one_cnts_dic.append(1)
            else:
                one_cnts_dic.append(0)
     i range(0,40) range 0 40 if i == 0:
            if n%4 in [1,2]:
                one_cnts_dic.append(1)
            else:
                one_cnts_dic.append(0)
        else:
            cycle = 2**(i+1) 
            if n%cycle in range(cycle//2, cycle, 2):
                one_cnts_dic.append(1)
            else:
                one_cnts_dic.append(0)
     i == 0 i 0 if n%4 in [1,2]:
                one_cnts_dic.append(1)
            else:
                one_cnts_dic.append(0)
         n%4 in [1,2] n%4 n 4 [1,2] 1 2 one_cnts_dic.append(1) one_cnts_dic.append one_cnts_dic append 1 one_cnts_dic.append(0) one_cnts_dic.append one_cnts_dic append 0 cycle = 2**(i+1) cycle 2**(i+1) 2 i+1 i 1 if n%cycle in range(cycle//2, cycle, 2):
                one_cnts_dic.append(1)
            else:
                one_cnts_dic.append(0)
     n%cycle in range(cycle//2, cycle, 2) n%cycle n cycle range(cycle//2, cycle, 2) range cycle//2 cycle 2 cycle 2 one_cnts_dic.append(1) one_cnts_dic.append one_cnts_dic append 1 one_cnts_dic.append(0) one_cnts_dic.append one_cnts_dic append 0 return one_cnts_dic one_cnts_dic n n a,b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b a_one_cnts = get_one_cnts(a-1) a_one_cnts get_one_cnts(a-1) get_one_cnts a-1 a 1 b_one_cnts = get_one_cnts(b) b_one_cnts get_one_cnts(b) get_one_cnts b ans = 0 ans 0 for i in range(40):
    if a_one_cnts[i] ^ b_one_cnts[i]:
        ans += 2**i i range(40) range 40 if a_one_cnts[i] ^ b_one_cnts[i]:
        ans += 2**i a_one_cnts[i] ^ b_one_cnts[i] a_one_cnts[i] a_one_cnts i b_one_cnts[i] b_one_cnts i ans += 2**i ans 2**i 2 i print(ans) print ans a,b = map(int, input().split()) map(int, input().split()) a b = map(int, input().split()) map(int, input().split()) b b_one_cnts = get_one_cnts(b) get_one_cnts(b) b_one_cnts ans += 2**i 2**i ans def get_one_cnts(n):
    one_cnts_dic = []
    for i in range(0,40): 
        if i == 0:
            if n%4 in [1,2]:
                one_cnts_dic.append(1)
            else:
                one_cnts_dic.append(0)
        else:
            cycle = 2**(i+1) 
            if n%cycle in range(cycle//2, cycle, 2):
                one_cnts_dic.append(1)
            else:
                one_cnts_dic.append(0)
    return one_cnts_dic def get_one_cnts(n):
    one_cnts_dic = []
    for i in range(0,40): 
        if i == 0:
            if n%4 in [1,2]:
                one_cnts_dic.append(1)
            else:
                one_cnts_dic.append(0)
        else:
            cycle = 2**(i+1) 
            if n%cycle in range(cycle//2, cycle, 2):
                one_cnts_dic.append(1)
            else:
                one_cnts_dic.append(0)
    return one_cnts_dic get_one_cnts a_one_cnts = get_one_cnts(a-1) get_one_cnts(a-1) a_one_cnts ans = 0 0 ans
def get_one_cnts(n):
    one_cnts_dic = []
    for i in range(0,40): 
        if i == 0:
            if n%4 in [1,2]:
                one_cnts_dic.append(1)
            else:
                one_cnts_dic.append(0)
        else:
            cycle = 2**(i+1) 
            if n%cycle in range(cycle//2, cycle, 2):
                one_cnts_dic.append(1)
            else:
                one_cnts_dic.append(0)
    return one_cnts_dic

a,b = map(int, input().split())
a_one_cnts = get_one_cnts(a-1)
b_one_cnts = get_one_cnts(b)
# print(a_one_cnts)
# print(b_one_cnts)
ans = 0
for i in range(40):
    if a_one_cnts[i] ^ b_one_cnts[i]:
        ans += 2**i

print(ans)