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:_) <- readInts
  print $ solve n a b

solve :: Int -> Int -> Int -> Int
solve n a b
  | (b - a) `mod` 2 == 0 = (b - a) `div` 2
  | otherwise = (minDistance * 2 + min' a b) `div` 2
  where
    minDistance = min (a - 1) (n - b)
    min' a b
      | (a - 1) <= (n - b) = b - 1
      | otherwise = n - a