ans :: Int -> Int -> Int -> Int
ans n a b
 	| (a' - b') `mod` 2 == 0 = (a' - b') `div` 2
	| a' > (n - b')          = n - b'
	| otherwise              = a'
	where
		a' = max a b
		b' = min a b

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