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
  | even (b - a) = (b - a) `div` 2
  | b - a == 1 && (b == 2 || a == n - 1) = 1
  | even n = min ((a + b - 1) `div` 2) ((n - a + n - b + 1) `div` 2)
  | odd n = min ((a + b - 1) `div` 2) ((n - a + n - b + 1) `div` 2)