import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a, b = map(int, read().split())
cnt_a = []
ans = 0
check = 1
while check <= a - 1:
    x, y = divmod(a, check * 2)
    cnt_a.append(x * check + max(0, y - check))
    check *= 2
check = 1
while check <= b:
    if len(cnt_a) != 0:
        aa = cnt_a.pop(0)
    else:
        aa = 0
    x, y = divmod(b + 1, check * 2)
    cnt = x * check + max(0, y - check) - aa
    if cnt % 2 == 1:
        ans += check
    check *= 2
print(ans) import sys sys read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 a, b = map(int, read().split()) a map(int, read().split()) map int read().split() ().split () read split b cnt_a = [] cnt_a [] ans = 0 ans 0 check = 1 check 1 while check <= a - 1:
    x, y = divmod(a, check * 2)
    cnt_a.append(x * check + max(0, y - check))
    check *= 2 check <= a - 1 check a - 1 a 1 x, y = divmod(a, check * 2) x divmod(a, check * 2) divmod a check * 2 check 2 y cnt_a.append(x * check + max(0, y - check)) cnt_a.append cnt_a append x * check + max(0, y - check) x * check x check max(0, y - check) max 0 y - check y check check *= 2 check 2 check = 1 check 1 while check <= b:
    if len(cnt_a) != 0:
        aa = cnt_a.pop(0)
    else:
        aa = 0
    x, y = divmod(b + 1, check * 2)
    cnt = x * check + max(0, y - check) - aa
    if cnt % 2 == 1:
        ans += check
    check *= 2 check <= b check b if len(cnt_a) != 0:
        aa = cnt_a.pop(0)
    else:
        aa = 0
     len(cnt_a) != 0 len(cnt_a) len cnt_a 0 aa = cnt_a.pop(0) aa cnt_a.pop(0) cnt_a.pop cnt_a pop 0 aa = 0 aa 0 x, y = divmod(b + 1, check * 2) x divmod(b + 1, check * 2) divmod b + 1 b 1 check * 2 check 2 y cnt = x * check + max(0, y - check) - aa cnt x * check + max(0, y - check) - aa x * check + max(0, y - check) x * check x check max(0, y - check) max 0 y - check y check aa if cnt % 2 == 1:
        ans += check
     cnt % 2 == 1 cnt % 2 cnt 2 1 ans += check ans check check *= 2 check 2 print(ans) print ans x, y = divmod(b + 1, check * 2) divmod(b + 1, check * 2) x cnt_a = [] [] cnt_a readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline read = sys.stdin.buffer.read sys.stdin.buffer.read read check *= 2 2 check ans += check check ans check = 1 1 check cnt = x * check + max(0, y - check) - aa x * check + max(0, y - check) - aa cnt check = 1 1 check y = divmod(a, check * 2) divmod(a, check * 2) y aa = cnt_a.pop(0) cnt_a.pop(0) aa check *= 2 2 check a, b = map(int, read().split()) map(int, read().split()) a b = map(int, read().split()) map(int, read().split()) b y = divmod(b + 1, check * 2) divmod(b + 1, check * 2) y readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines x, y = divmod(a, check * 2) divmod(a, check * 2) x aa = 0 0 aa ans = 0 0 ans
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a, b = map(int, read().split())
cnt_a = []
ans = 0
check = 1
while check <= a - 1:
    x, y = divmod(a, check * 2)
    cnt_a.append(x * check + max(0, y - check))
    check *= 2
check = 1
while check <= b:
    if len(cnt_a) != 0:
        aa = cnt_a.pop(0)
    else:
        aa = 0
    x, y = divmod(b + 1, check * 2)
    cnt = x * check + max(0, y - check) - aa
    if cnt % 2 == 1:
        ans += check
    check *= 2
print(ans)
