import Control.Applicative
import Data.Bits

logBase2 :: Int -> Int
logBase2 x = finiteBitSize x - 1 - countLeadingZeros x

-- 00
-- 01
-- 10
--
solve :: Int -> Int
solve n 
    | n <= 0 = 0
    | otherwise = 
        foldr (\(i, b) acc -> if b then setBit acc i else acc) 0 [ (i,  calc i) | i <- [0..logBase2 n] ]
    where
    calc 0 = [False,True,True,False] !! (n `mod` 4)
    calc i | even q = False
           | otherwise = even r
        where
        (q,r) = divMod n (2^i)
    
main :: IO ()
main = do
    [a,b] <- map read . words <$> getLine
    print (solve b `xor` solve (a-1))
