import Control.Monad
import Data.Array
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Maybe
import Data.Ord

readInts :: IO [Int]
readInts = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

main = do
  (n:a:b:_) <- map read . words <$> getLine
  print $ solve n a b

solve :: Integer -> Integer -> Integer -> Integer
solve n a b
  | (b - a) `mod` (2 :: Integer) == 0 = (b - a) `div` (2 :: Integer)
  | otherwise = min ((a + b) `div` (2 :: Integer)) ((n - b + n - a) `div` (2 :: Integer))