import Data.Bits

main :: IO ()
main = do
  a:b:_ <- fmap (\x -> read x :: Int) <$> words <$> getLine
  print $ (xors (a - 1)) `xor` (xors b)
    where
      xors a = (((a + 1) `div` 2) .&. 1) `xor` (if (a .&. 1) == 1 then 0 else a)
