{-# LANGUAGE ScopedTypeVariables #-}
--n -bit flags in 0~
number_of_n_bit::Int->Int->Int
number_of_n_bit n a = let (d,m) = divMod (a+1) (2^n) in
                      ((2^(n-1)) * d) + (max 0 ( m - (2^(n-1))))

--40bit is enough to this

bin_to_int::[Bool]->Integer
bin_to_int = sum . (map (\(i,_)->(2^i))) . (filter snd) . (zip [(0::Int)..])

solver::Int->Int->Integer
solver a b = bin_to_int  [mod ((number_of_n_bit n b)-(number_of_n_bit n (a-1))) 2 == 1 |n<-[1..40]]

main::IO()
main=do
  a:b:[]<-return.map read.words=<<getLine
  print (solver a b)