import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (n : a : b : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  let
    a' = min a b
    b' = max a b
    d = b' - a'
    (q, r) = d `divMod` 2
  print $ if r == 0 then q else if a' - 1 <= n - b' then a' + (d `div` 2) else (n - b' + 1) + (d `div` 2)

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