module Main where
import Control.Monad
import Data.Bits

solve :: Integer -> Integer
solve n
    | r == 1 = (q+1) `mod` 2
    | r == 0 = n `xor` solve (n-1)
    where r = n `mod` 2
          q = n `div` 2

main :: IO ()
main = do
    [a,b] <-(map read. words)<$> getLine
    print (solve (a-1) `xor` solve b)