import Data.Bits 

main = do
    [a,b] <- map read . words <$> getLine :: IO [Int]
    print $ solve a b

solve :: Int -> Int -> Int
solve a b
    | a == b = b
    | even a && even num = if odd $ num `div` 2 then 1 else 0
    | even a && odd num = if odd $ (num-1) `div` 2 then xor 1 b else b
    | otherwise = xor a $ solve (a+1) b
        where
            num = b-a+1