import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.Bits (shiftR)

main :: IO ()
main = do
  (n : a : b : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  let
    d = b - a
  print $ if even d then halve d else min (a - 1) (n - b' - 1) + 1 + halve (pred d)

halve :: Int -> Int
halve k | 0 <= k = shiftR k 1

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n
