from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

a, b = MAP()
a -= 1

s = deque()
tmp = (b+1)//2-(a+1)//2
s.appendleft(str(tmp % 2))
i = 1
while 2**i <= b:
    x = max(0, a%(2**(i+1)) - (2**i-1))
    y = max(0, b%(2**(i+1)) - (2**i-1))
    tmp = y - x
    s.appendleft(str(tmp % 2))
    i += 1
t = list(s)
ans = "".join(t)
print(int(ans, 2)) from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement from collections import deque,defaultdict,Counter from bisect import bisect_left,bisect_right from operator import itemgetter from heapq import heapify,heappop,heappush from queue import Queue,LifoQueue,PriorityQueue from copy import deepcopy from time import time import string string import sys sys sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 def input() : return sys.stdin.readline().strip() input def INT()   : return int(input()) INT def MAP()   : return map(int,input().split()) MAP def LIST()  : return list(MAP()) LIST a, b = MAP() a MAP() MAP b a -= 1 a 1 s = deque() s deque() deque tmp = (b+1)//2-(a+1)//2 tmp (b+1)//2-(a+1)//2 (b+1)//2 b+1 b 1 2 (a+1)//2 a+1 a 1 2 s.appendleft(str(tmp % 2)) s.appendleft s appendleft str(tmp % 2) str tmp % 2 tmp 2 i = 1 i 1 while 2**i <= b:
    x = max(0, a%(2**(i+1)) - (2**i-1))
    y = max(0, b%(2**(i+1)) - (2**i-1))
    tmp = y - x
    s.appendleft(str(tmp % 2))
    i += 1 2**i <= b 2**i 2 i b x = max(0, a%(2**(i+1)) - (2**i-1)) x max(0, a%(2**(i+1)) - (2**i-1)) max 0 a%(2**(i+1)) - (2**i-1) a%(2**(i+1)) a 2**(i+1) 2 i+1 i 1 2**i-1 2**i 2 i 1 y = max(0, b%(2**(i+1)) - (2**i-1)) y max(0, b%(2**(i+1)) - (2**i-1)) max 0 b%(2**(i+1)) - (2**i-1) b%(2**(i+1)) b 2**(i+1) 2 i+1 i 1 2**i-1 2**i 2 i 1 tmp = y - x tmp y - x y x s.appendleft(str(tmp % 2)) s.appendleft s appendleft str(tmp % 2) str tmp % 2 tmp 2 i += 1 i 1 t = list(s) t list(s) list s ans = "".join(t) ans "".join(t) "".join "" join t print(int(ans, 2)) print int(ans, 2) int ans 2 y = max(0, b%(2**(i+1)) - (2**i-1)) max(0, b%(2**(i+1)) - (2**i-1)) y x = max(0, a%(2**(i+1)) - (2**i-1)) max(0, a%(2**(i+1)) - (2**i-1)) x def input() : return sys.stdin.readline().strip() def input() : return sys.stdin.readline().strip() input def LIST()  : return list(MAP()) def LIST()  : return list(MAP()) LIST a -= 1 1 a i += 1 1 i def INT()   : return int(input()) def INT()   : return int(input()) INT t = list(s) list(s) t s = deque() deque() s b = MAP() MAP() b def MAP()   : return map(int,input().split()) def MAP()   : return map(int,input().split()) MAP ans = "".join(t) "".join(t) ans a, b = MAP() MAP() a i = 1 1 i tmp = y - x y - x tmp tmp = (b+1)//2-(a+1)//2 (b+1)//2-(a+1)//2 tmp
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

a, b = MAP()
a -= 1

s = deque()
tmp = (b+1)//2-(a+1)//2
s.appendleft(str(tmp % 2))
i = 1
while 2**i <= b:
    x = max(0, a%(2**(i+1)) - (2**i-1))
    y = max(0, b%(2**(i+1)) - (2**i-1))
    tmp = y - x
    s.appendleft(str(tmp % 2))
    i += 1
t = list(s)
ans = "".join(t)
print(int(ans, 2))