solve :: [Int] -> Int
solve (n:a:b:xs) =
  if (a - b) `mod` 2 == 0 then
      (b - a) `div` 2
  else if b -  1 < n - a then 
    if x `mod` 2 == 0  then 
      x `div` 2
    else
      b - 1
  else 
    if y `mod` 2 == 0  then 
      y `div` 2
    else
      n - a
    where 
      x = b + a - 1
      y = 2 * n - b - a

main = do
  x <- (map read) . words <$> getLine
  print $ solve x
