from sys import stdin
A,B = [int(x) for x in stdin.readline().rstrip().split()]

def f(n):
    res = 0
    tmp = 1
    while tmp <= n:
        tmp *= 2
        num = ((n+1)//tmp)*(tmp//2)
        num += max(0,(n+1)%tmp - tmp//2)
        if num % 2 != 0:
            res += (tmp//2)
    return res

print(f(A-1)^f(B)) from sys import stdin int(x) for x in stdin.readline().rstrip().split() for x in stdin.readline().rstrip().split() x stdin.readline().rstrip().split() stdin.readline().rstrip().split stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip split for x in stdin.readline().rstrip().split() int(x) int x A,B = [int(x) for x in stdin.readline().rstrip().split()] A [int(x) for x in stdin.readline().rstrip().split()] B def f(n):
    res = 0
    tmp = 1
    while tmp <= n:
        tmp *= 2
        num = ((n+1)//tmp)*(tmp//2)
        num += max(0,(n+1)%tmp - tmp//2)
        if num % 2 != 0:
            res += (tmp//2)
    return res f res = 0 res 0 tmp = 1 tmp 1 while tmp <= n:
        tmp *= 2
        num = ((n+1)//tmp)*(tmp//2)
        num += max(0,(n+1)%tmp - tmp//2)
        if num % 2 != 0:
            res += (tmp//2)
     tmp <= n tmp n tmp *= 2 tmp 2 num = ((n+1)//tmp)*(tmp//2) num ((n+1)//tmp)*(tmp//2) (n+1)//tmp n+1 n 1 tmp tmp//2 tmp 2 num += max(0,(n+1)%tmp - tmp//2) num max(0,(n+1)%tmp - tmp//2) max 0 (n+1)%tmp - tmp//2 (n+1)%tmp n+1 n 1 tmp tmp//2 tmp 2 if num % 2 != 0:
            res += (tmp//2)
     num % 2 != 0 num % 2 num 2 0 res += (tmp//2) res tmp//2 tmp 2 return res res n n print(f(A-1)^f(B)) print f(A-1)^f(B) f(A-1) f A-1 A 1 f(B) f B def f(n):
    res = 0
    tmp = 1
    while tmp <= n:
        tmp *= 2
        num = ((n+1)//tmp)*(tmp//2)
        num += max(0,(n+1)%tmp - tmp//2)
        if num % 2 != 0:
            res += (tmp//2)
    return res def f(n):
    res = 0
    tmp = 1
    while tmp <= n:
        tmp *= 2
        num = ((n+1)//tmp)*(tmp//2)
        num += max(0,(n+1)%tmp - tmp//2)
        if num % 2 != 0:
            res += (tmp//2)
    return res f A,B = [int(x) for x in stdin.readline().rstrip().split()] [int(x) for x in stdin.readline().rstrip().split()] A B = [int(x) for x in stdin.readline().rstrip().split()] [int(x) for x in stdin.readline().rstrip().split()] B
from sys import stdin
A,B = [int(x) for x in stdin.readline().rstrip().split()]

def f(n):
    res = 0
    tmp = 1
    while tmp <= n:
        tmp *= 2
        num = ((n+1)//tmp)*(tmp//2)
        num += max(0,(n+1)%tmp - tmp//2)
        if num % 2 != 0:
            res += (tmp//2)
    return res

print(f(A-1)^f(B))