main :: IO ()
main = do
  [n, a, b] <- map read . words <$> getLine
  print $ solve n a b

solve :: Int -> Int -> Int -> Int
solve n a b
  | odd (b - a) = min (max (n - a) (n - b)) (max (a - 1) (b - 1))
  | otherwise = (b - a) `div` 2
