module Main where

import Data.List
import Control.Monad
import Debug.Trace
import Data.Bits

solve :: Integer -> Integer -> Integer
solve a b = 
    if a `mod` 2 == 0 && b `mod` 2 == 0 then
        (b-a) `div` 2 `mod` 2 `xor` b
    else if a `mod` 2 == 0 && b `mod` 2 == 1 then
        (b-a+1) `div` 2 `mod` 2
    else if a `mod` 2 == 1 && b `mod` 2 == 0 then
        (b-a-1) `div` 2 `mod` 2 `xor` a `xor` b
    else 
        (b - a) `div`2 `mod` 2 `xor` b

main = do
    [a,b] <- fmap read . words <$> getLine
    print $ solve a b




