def solve():
    A, B = map(int,input().split())
    A_res = func(max(A-1,0))
    B_res = func(B)
    ans = 0
    two_factor = 1
    for i in range(60):
        if not A_res[i] == B_res[i]:
            ans += two_factor
        two_factor *= 2
    
    print(ans)

def func(N):
    res = [0] * 60
    for i in range(60):
        if i == 0 and not (N % 4 == 0 or N % 4 == 3):
            res[i] = 1
        elif N & (1<<i):
            if (N+1) % 2 != 0:
                res[i] = 1

    return res

if __name__ == '__main__':
    solve() def solve():
    A, B = map(int,input().split())
    A_res = func(max(A-1,0))
    B_res = func(B)
    ans = 0
    two_factor = 1
    for i in range(60):
        if not A_res[i] == B_res[i]:
            ans += two_factor
        two_factor *= 2
    
    print(ans) solve A, B = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B A_res = func(max(A-1,0)) A_res func(max(A-1,0)) func max(A-1,0) max A-1 A 1 0 B_res = func(B) B_res func(B) func B ans = 0 ans 0 two_factor = 1 two_factor 1 for i in range(60):
        if not A_res[i] == B_res[i]:
            ans += two_factor
        two_factor *= 2
    
     i range(60) range 60 if not A_res[i] == B_res[i]:
            ans += two_factor
         not A_res[i] == B_res[i] A_res[i] == B_res[i] A_res[i] A_res i B_res[i] B_res i ans += two_factor ans two_factor two_factor *= 2 two_factor 2 print(ans) print ans def func(N):
    res = [0] * 60
    for i in range(60):
        if i == 0 and not (N % 4 == 0 or N % 4 == 3):
            res[i] = 1
        elif N & (1<<i):
            if (N+1) % 2 != 0:
                res[i] = 1

    return res func res = [0] * 60 res [0] * 60 [0] 0 60 for i in range(60):
        if i == 0 and not (N % 4 == 0 or N % 4 == 3):
            res[i] = 1
        elif N & (1<<i):
            if (N+1) % 2 != 0:
                res[i] = 1

     i range(60) range 60 if i == 0 and not (N % 4 == 0 or N % 4 == 3):
            res[i] = 1
        elif N & (1<<i):
            if (N+1) % 2 != 0:
                res[i] = 1

     i == 0 and not (N % 4 == 0 or N % 4 == 3) i == 0 i 0 not (N % 4 == 0 or N % 4 == 3) N % 4 == 0 or N % 4 == 3 N % 4 == 0 N % 4 N 4 0 N % 4 == 3 N % 4 N 4 3 res[i] = 1 res[i] res i 1 elif N & (1<<i):
            if (N+1) % 2 != 0:
                res[i] = 1

     N & (1<<i) N 1<<i 1 i if (N+1) % 2 != 0:
                res[i] = 1

     (N+1) % 2 != 0 (N+1) % 2 N+1 N 1 2 0 res[i] = 1 res[i] res i 1 return res res N N if __name__ == '__main__':
    solve() __name__ == '__main__' __name__ '__main__' solve() solve def func(N):
    res = [0] * 60
    for i in range(60):
        if i == 0 and not (N % 4 == 0 or N % 4 == 3):
            res[i] = 1
        elif N & (1<<i):
            if (N+1) % 2 != 0:
                res[i] = 1

    return res def func(N):
    res = [0] * 60
    for i in range(60):
        if i == 0 and not (N % 4 == 0 or N % 4 == 3):
            res[i] = 1
        elif N & (1<<i):
            if (N+1) % 2 != 0:
                res[i] = 1

    return res func def solve():
    A, B = map(int,input().split())
    A_res = func(max(A-1,0))
    B_res = func(B)
    ans = 0
    two_factor = 1
    for i in range(60):
        if not A_res[i] == B_res[i]:
            ans += two_factor
        two_factor *= 2
    
    print(ans) def solve():
    A, B = map(int,input().split())
    A_res = func(max(A-1,0))
    B_res = func(B)
    ans = 0
    two_factor = 1
    for i in range(60):
        if not A_res[i] == B_res[i]:
            ans += two_factor
        two_factor *= 2
    
    print(ans) solve
def solve():
    A, B = map(int,input().split())
    A_res = func(max(A-1,0))
    B_res = func(B)
    ans = 0
    two_factor = 1
    for i in range(60):
        if not A_res[i] == B_res[i]:
            ans += two_factor
        two_factor *= 2
    
    print(ans)

def func(N):
    res = [0] * 60
    for i in range(60):
        if i == 0 and not (N % 4 == 0 or N % 4 == 3):
            res[i] = 1
        elif N & (1<<i):
            if (N+1) % 2 != 0:
                res[i] = 1

    return res

if __name__ == '__main__':
    solve()