#from functools import reduce
from math import log
A,B = map(int, input().split())

def f(x):
    if x <= 0:
        return []
    n = int(log(x,2))
    r = [0 for i in range(n+1)]
    while x > 0:
        n = int(log(x,2))
        for i in range(n):
            r[i] += pow(2,n-1)
        x -= pow(2,n)
        r[n] += x+1
    return r

a = f(A-1)
b = f(B)
for i,v in enumerate(a):
    b[i] -= v

ans = 0
for i,v in enumerate(b):
    if v % 2 == 1:
        ans += pow(2,i)
print(ans)

#print(reduce(lambda x,y:x^y, range(A,B+1))) from math import log A,B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B def f(x):
    if x <= 0:
        return []
    n = int(log(x,2))
    r = [0 for i in range(n+1)]
    while x > 0:
        n = int(log(x,2))
        for i in range(n):
            r[i] += pow(2,n-1)
        x -= pow(2,n)
        r[n] += x+1
    return r f if x <= 0:
        return []
     x <= 0 x 0 return [] [] n = int(log(x,2)) n int(log(x,2)) int log(x,2) log x 2 0 for i in range(n+1) for i in range(n+1) i range(n+1) range n+1 n 1 for i in range(n+1) 0 r = [0 for i in range(n+1)] r [0 for i in range(n+1)] while x > 0:
        n = int(log(x,2))
        for i in range(n):
            r[i] += pow(2,n-1)
        x -= pow(2,n)
        r[n] += x+1
     x > 0 x 0 n = int(log(x,2)) n int(log(x,2)) int log(x,2) log x 2 for i in range(n):
            r[i] += pow(2,n-1)
         i range(n) range n r[i] += pow(2,n-1) r[i] r i pow(2,n-1) pow 2 n-1 n 1 x -= pow(2,n) x pow(2,n) pow 2 n r[n] += x+1 r[n] r n x+1 x 1 return r r x x a = f(A-1) a f(A-1) f A-1 A 1 b = f(B) b f(B) f B for i,v in enumerate(a):
    b[i] -= v i v enumerate(a) enumerate a b[i] -= v b[i] b i v ans = 0 ans 0 for i,v in enumerate(b):
    if v % 2 == 1:
        ans += pow(2,i) i v enumerate(b) enumerate b if v % 2 == 1:
        ans += pow(2,i) v % 2 == 1 v % 2 v 2 1 ans += pow(2,i) ans pow(2,i) pow 2 i print(ans) print ans a = f(A-1) f(A-1) a ans = 0 0 ans b = f(B) f(B) b A,B = map(int, input().split()) map(int, input().split()) A def f(x):
    if x <= 0:
        return []
    n = int(log(x,2))
    r = [0 for i in range(n+1)]
    while x > 0:
        n = int(log(x,2))
        for i in range(n):
            r[i] += pow(2,n-1)
        x -= pow(2,n)
        r[n] += x+1
    return r def f(x):
    if x <= 0:
        return []
    n = int(log(x,2))
    r = [0 for i in range(n+1)]
    while x > 0:
        n = int(log(x,2))
        for i in range(n):
            r[i] += pow(2,n-1)
        x -= pow(2,n)
        r[n] += x+1
    return r f ans += pow(2,i) pow(2,i) ans B = map(int, input().split()) map(int, input().split()) B
#from functools import reduce
from math import log
A,B = map(int, input().split())

def f(x):
    if x <= 0:
        return []
    n = int(log(x,2))
    r = [0 for i in range(n+1)]
    while x > 0:
        n = int(log(x,2))
        for i in range(n):
            r[i] += pow(2,n-1)
        x -= pow(2,n)
        r[n] += x+1
    return r

a = f(A-1)
b = f(B)
for i,v in enumerate(a):
    b[i] -= v

ans = 0
for i,v in enumerate(b):
    if v % 2 == 1:
        ans += pow(2,i)
print(ans)

#print(reduce(lambda x,y:x^y, range(A,B+1)))
