import Data.List
import Data.Char
import Data.Maybe
import Control.Monad
import qualified Data.ByteString.Char8 as BS8

main :: IO ()
main = do
    [n,a,b] <- unfoldr (BS8.readInteger . BS8.dropWhile isSpace) <$> BS8.getLine

    let
        diff = b - a
        nb = n - b
        na = a - 1
        nmin = (na + 1) + ((b - (na + 1) - 1) `div` 2)
        nmax = (nb + 1) + ((n - (a + (nb + 1))) `div` 2)

    print $ if diff `mod` 2 == 0
        then div diff 2
        else min nmin nmax
