main = do
  n:a:b:_ <- map read . words <$> getLine :: IO [Integer]
  putStrLn $ show $ dist n a b

dist n a b | b < a              = dist n b a
           | mod (b - a) 2 == 0 = div (b - a) 2
           | otherwise          = min (n - a) (b - 1)
