import Data.Bits
p a b = if a<b*2 then b else p a (b*2)
g l x k r= if x<k then r else if mod (length [a|a<-l,mod a (2*k) >=k]) 2 == 0 then g l x (2*k) r else g l x (2*k) (r+k)
main=do
 [a,b]<-map read.words<$>getLine ::IO[Int]
 print$(g [a,a+1..b] (p b 1) 1 1)-1