A, B = map(int, input().split())

A -= 1
ans = 0

def calc(x):
    x += 1
    lst = [0] * 65
    count = 2
    for i in range(64):
        #0の個数を数える
        tmp = x // count
        a = x % count
        a = min(a, count // 2)
        lst[i] = (x - (a + tmp * count // 2)) % 2
        count *= 2
    return lst

lstA = calc(A)
lstB = calc(B)
# print (lstA)
# print (lstB)
tmp = 1
for i in range(65):
    if abs(lstA[i] - lstB[i]) == 1:
        ans += tmp
    tmp *= 2

print (ans) A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B A -= 1 A 1 ans = 0 ans 0 def calc(x):
    x += 1
    lst = [0] * 65
    count = 2
    for i in range(64):
        #0の個数を数える
        tmp = x // count
        a = x % count
        a = min(a, count // 2)
        lst[i] = (x - (a + tmp * count // 2)) % 2
        count *= 2
    return lst calc x += 1 x 1 lst = [0] * 65 lst [0] * 65 [0] 0 65 count = 2 count 2 for i in range(64):
        #0の個数を数える
        tmp = x // count
        a = x % count
        a = min(a, count // 2)
        lst[i] = (x - (a + tmp * count // 2)) % 2
        count *= 2
     i range(64) range 64 tmp = x // count tmp x // count x count a = x % count a x % count x count a = min(a, count // 2) a min(a, count // 2) min a count // 2 count 2 lst[i] = (x - (a + tmp * count // 2)) % 2 lst[i] lst i (x - (a + tmp * count // 2)) % 2 x - (a + tmp * count // 2) x a + tmp * count // 2 a tmp * count // 2 tmp * count tmp count 2 2 count *= 2 count 2 return lst lst x x lstA = calc(A) lstA calc(A) calc A lstB = calc(B) lstB calc(B) calc B tmp = 1 tmp 1 for i in range(65):
    if abs(lstA[i] - lstB[i]) == 1:
        ans += tmp
    tmp *= 2 i range(65) range 65 if abs(lstA[i] - lstB[i]) == 1:
        ans += tmp
     abs(lstA[i] - lstB[i]) == 1 abs(lstA[i] - lstB[i]) abs lstA[i] - lstB[i] lstA[i] lstA i lstB[i] lstB i 1 ans += tmp ans tmp tmp *= 2 tmp 2 print (ans) print ans tmp *= 2 2 tmp ans = 0 0 ans lstA = calc(A) calc(A) lstA def calc(x):
    x += 1
    lst = [0] * 65
    count = 2
    for i in range(64):
        #0の個数を数える
        tmp = x // count
        a = x % count
        a = min(a, count // 2)
        lst[i] = (x - (a + tmp * count // 2)) % 2
        count *= 2
    return lst def calc(x):
    x += 1
    lst = [0] * 65
    count = 2
    for i in range(64):
        #0の個数を数える
        tmp = x // count
        a = x % count
        a = min(a, count // 2)
        lst[i] = (x - (a + tmp * count // 2)) % 2
        count *= 2
    return lst calc A -= 1 1 A tmp = 1 1 tmp lstB = calc(B) calc(B) lstB ans += tmp tmp ans B = map(int, input().split()) map(int, input().split()) B A, B = map(int, input().split()) map(int, input().split()) A
A, B = map(int, input().split())

A -= 1
ans = 0

def calc(x):
    x += 1
    lst = [0] * 65
    count = 2
    for i in range(64):
        #0の個数を数える
        tmp = x // count
        a = x % count
        a = min(a, count // 2)
        lst[i] = (x - (a + tmp * count // 2)) % 2
        count *= 2
    return lst

lstA = calc(A)
lstB = calc(B)
# print (lstA)
# print (lstB)
tmp = 1
for i in range(65):
    if abs(lstA[i] - lstB[i]) == 1:
        ans += tmp
    tmp *= 2

print (ans)