import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

bn = 2 ** 42

def bb(v):
	ra = bin(v+bn)[3:][::-1]
	return ra

def cc(v, i):
	r = pow(2, i)
	vn = v+1
	vna = vn //(2*r)
	vnb = vn % (2*r)
	ret = vna * r
	ret += max(vnb - r, 0)
	#pa((v,i,ret))
	return ret

def main():
	#a = int(input())
	f, t = tin()
	#s = input()
	ret = 0
	for i, _ in enumerate(bb(0)):
		r = pow(2, i)
		nn = cc(t,i) - cc(f-1, i)
		if (nn) % 2 == 1:
			#pa(r)
			ret += r
	return ret
		
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret) import sys sys input_methods=['clipboard','file','key'] input_methods ['clipboard','file','key'] 'clipboard' 'file' 'key' using_method=0 using_method 0 input_method=input_methods[using_method] input_method input_methods[using_method] input_methods using_method tin=lambda : map(int, input().split()) tin lambda : map(int, input().split()) map(int, input().split()) map int input().split() ().split () input split lin=lambda : list(tin()) lin lambda : list(tin()) list(tin()) list tin() tin mod=1000000007 mod 1000000007 bn = 2 ** 42 bn 2 ** 42 2 42 def bb(v):
	ra = bin(v+bn)[3:][::-1]
	return ra bb ra = bin(v+bn)[3:][::-1] ra bin(v+bn)[3:][::-1] [3:] (v+bn) bin v+bn v bn 3: 3 ::-1 -1 return ra ra v v def cc(v, i):
	r = pow(2, i)
	vn = v+1
	vna = vn //(2*r)
	vnb = vn % (2*r)
	ret = vna * r
	ret += max(vnb - r, 0)
	#pa((v,i,ret))
	return ret cc r = pow(2, i) r pow(2, i) pow 2 i vn = v+1 vn v+1 v 1 vna = vn //(2*r) vna vn //(2*r) vn 2*r 2 r vnb = vn % (2*r) vnb vn % (2*r) vn 2*r 2 r ret = vna * r ret vna * r vna r ret += max(vnb - r, 0) ret max(vnb - r, 0) max vnb - r vnb r 0 return ret ret v v i i def main():
	#a = int(input())
	f, t = tin()
	#s = input()
	ret = 0
	for i, _ in enumerate(bb(0)):
		r = pow(2, i)
		nn = cc(t,i) - cc(f-1, i)
		if (nn) % 2 == 1:
			#pa(r)
			ret += r
	return ret
		
	
	
	
#+++++ main f, t = tin() f tin() tin t ret = 0 ret 0 for i, _ in enumerate(bb(0)):
		r = pow(2, i)
		nn = cc(t,i) - cc(f-1, i)
		if (nn) % 2 == 1:
			#pa(r)
			ret += r
	 i _ enumerate(bb(0)) enumerate bb(0) bb 0 r = pow(2, i) r pow(2, i) pow 2 i nn = cc(t,i) - cc(f-1, i) nn cc(t,i) - cc(f-1, i) cc(t,i) cc t i cc(f-1, i) cc f-1 f 1 i if (nn) % 2 == 1:
			#pa(r)
			ret += r
	 (nn) % 2 == 1 (nn) % 2 nn 2 1 ret += r ret r return ret ret isTest=False isTest False def pa(v):
	if isTest:
		print(v)
		 pa if isTest:
		print(v)
		 isTest print(v) print v v v def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l input_clipboard import clipboard clipboard input_text=clipboard.get() input_text clipboard.get() clipboard.get clipboard get input_l=input_text.splitlines() input_l input_text.splitlines() input_text.splitlines input_text splitlines for l in input_l:
		yield l l input_l yield l l if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret) __name__ == "__main__" __name__ "__main__" if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	 sys.platform =='ios' sys.platform sys platform 'ios' if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		 input_method==input_methods[0] input_method input_methods[0] input_methods 0 ic=input_clipboard() ic input_clipboard() input_clipboard input = lambda : ic.__next__() input lambda : ic.__next__() ic.__next__() ic.__next__ ic __next__ elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		 input_method==input_methods[1] input_method input_methods[1] input_methods 1 sys.stdin=open('inputFile.txt') sys.stdin sys stdin open('inputFile.txt') open 'inputFile.txt' isTest=True isTest True ret = main() ret main() main if ret is not None:
		print(ret) ret is not None ret None print(ret) print ret bn = 2 ** 42 2 ** 42 bn input_methods=['clipboard','file','key'] ['clipboard','file','key'] input_methods def cc(v, i):
	r = pow(2, i)
	vn = v+1
	vna = vn //(2*r)
	vnb = vn % (2*r)
	ret = vna * r
	ret += max(vnb - r, 0)
	#pa((v,i,ret))
	return ret def cc(v, i):
	r = pow(2, i)
	vn = v+1
	vna = vn //(2*r)
	vnb = vn % (2*r)
	ret = vna * r
	ret += max(vnb - r, 0)
	#pa((v,i,ret))
	return ret cc def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l input_clipboard def pa(v):
	if isTest:
		print(v)
		 def pa(v):
	if isTest:
		print(v)
		 pa input_method=input_methods[using_method] input_methods[using_method] input_method tin=lambda : map(int, input().split()) lambda : map(int, input().split()) tin def bb(v):
	ra = bin(v+bn)[3:][::-1]
	return ra def bb(v):
	ra = bin(v+bn)[3:][::-1]
	return ra bb mod=1000000007 1000000007 mod ret = main() main() ret def main():
	#a = int(input())
	f, t = tin()
	#s = input()
	ret = 0
	for i, _ in enumerate(bb(0)):
		r = pow(2, i)
		nn = cc(t,i) - cc(f-1, i)
		if (nn) % 2 == 1:
			#pa(r)
			ret += r
	return ret
		
	
	
	
#+++++ def main():
	#a = int(input())
	f, t = tin()
	#s = input()
	ret = 0
	for i, _ in enumerate(bb(0)):
		r = pow(2, i)
		nn = cc(t,i) - cc(f-1, i)
		if (nn) % 2 == 1:
			#pa(r)
			ret += r
	return ret
		
	
	
	
#+++++ main input = lambda : ic.__next__() lambda : ic.__next__() input isTest=True True isTest using_method=0 0 using_method lin=lambda : list(tin()) lambda : list(tin()) lin isTest=False False isTest ic=input_clipboard() input_clipboard() ic
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

bn = 2 ** 42

def bb(v):
	ra = bin(v+bn)[3:][::-1]
	return ra

def cc(v, i):
	r = pow(2, i)
	vn = v+1
	vna = vn //(2*r)
	vnb = vn % (2*r)
	ret = vna * r
	ret += max(vnb - r, 0)
	#pa((v,i,ret))
	return ret

def main():
	#a = int(input())
	f, t = tin()
	#s = input()
	ret = 0
	for i, _ in enumerate(bb(0)):
		r = pow(2, i)
		nn = cc(t,i) - cc(f-1, i)
		if (nn) % 2 == 1:
			#pa(r)
			ret += r
	return ret
		
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)