import Data.List.Split

data Way = R | L

countTolls :: Way -> Int -> [Int] -> Int
countTolls R x tolls = length $ filter (x<) tolls
countTolls L x tolls = length $ filter (x>) tolls

judgeSmaller :: Int -> [Int] -> Int
judgeSmaller x tolls = min (countTolls R x tolls) (countTolls L x tolls)

main = do
	str <- getLine
	let sstr = splitOn " " str
	let nums = map (read :: String -> Int) sstr
	str' <- getLine
	let sstr' = splitOn " " str'
	let nums' = map (read :: String -> Int) sstr'
	let n = nums !! 0
	let m = nums !! 1
	let x = nums !! 2
	let way = judgeSmaller x nums'
	putStrLn $ show way
	
	