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

solve :: Integer -> Integer -> Integer -> Integer
solve n a b
  | mod (b - a) 2 == 0 = div (b - a) 2
  | otherwise = div (b - a) 2 + min (n - b) a