import Data.Bits

main = do
    [a, b] <- map read . words <$> getLine
    let ns = map (numBits a (b + 1)) [0..40]
        xs = map (\k -> if numBits a (b + 1) k `mod` 2 == 1 then 1 `shift` k else 0) $ [0..40]
    print (ns :: [Int])
    print $ sum (xs :: [Int])

roundDown :: Int -> Int -> Int
roundDown n k = n `div` k * k

roundUp :: Int -> Int -> Int
roundUp n k = (n + k - 1) `div` k * k

nextMultiple :: Int -> Int -> Int
nextMultiple n k = (n + k - 1)

-- numBits :: Int -> Int -> Int -> Int
-- numBits b e k = let twoPowK = 1 `shift` k
--                     twoPowKPlus1 = 1 `shift` (k + 1)
--                     m = b + roundDown (e - b) twoPowKPlus1
--                     m' = roundUp m twoPowK
--                     x = (m - b) `div` 2
--                     y = if m' `mod` twoPowKPlus1 == 0 then min m' e - m else min (m' + twoPowK) e - min m' e
--                     in x + y

numBits :: Int -> Int -> Int -> Int
numBits b e k = let twoPowK = 1 `shift` k
                    twoPowKPlus1 = 1 `shift` (k + 1)
                    b' = roundDown b twoPowKPlus1
                    b'' = b' + twoPowK
                    e' = roundUp e twoPowKPlus1
                    e'' = e' - twoPowK
                    x = (e' - b') `div` 2
                    y = max (e' - max e e'') 0
                    z = max (b - b'') 0
                    in x - y - z