import Data.List

toInt :: String -> Int
toInt = read :: String -> Int

main = do
  [x, a, b] <- map toInt . words <$> getLine
  let l = if mod (b-a) 2 == 0 then div (b-a) 2 else x
  print $ minimum [l, x-a, b-1]
