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

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