{-# LANGUAGE BangPatterns #-}

import Control.Monad
import Data.List
import Data.Bits
import Debug.Trace
import Data.Maybe
import qualified Data.ByteString.Char8 as C

main :: IO ()
main = do
  [a, b] <- readInts
  print $ solve a b

{-
0 1 0 1 -
0 0 1 1 -
0 0 0 0 1

0 to 4
000 001 010 011 100
n = 5
L   0
L+1 0
L+2 1

q is odd then 
L   2 (if q is odd then 1 else 0)
L+1 4 (if r > 2 and (4 - r) is odd then 1 else 0)
L+2 8 (if r > 4 and (8 - r) is odd then 1 else 0)
-}

solve a b = solveSub a 1 0 `xor` solveSub (b + 1) 1 0 `xor` calcLsb a `xor` calcLsb (b + 1)
  where
    calcLsb x = if (odd $ x `div` 2) then 1 else 0
    solveSub :: Int -> Int -> Integer -> Integer
    solveSub x i acc =
      if d > x
        then next
        else solveSub x (i + 1) next
      where
        d = bit (i + 1)
        r = x `mod` d
        next = if (r > bit i) && odd (d - r) then acc + (bit i) else acc


-- 以下ライブラリ

readInts :: IO [Int]
readInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

readNInts :: Int -> IO [[Int]]
readNInts = flip replicateM readInts

readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . C.readInteger) . C.words <$> C.getLine

readNIntegers :: Int -> IO [[Integer]]
readNIntegers = flip replicateM readIntegers

getNLns :: Int -> IO [String]
getNLns = flip replicateM getLine