import Data.List (sort)

main = do
    [m, n, x] <- map read . words <$> getLine
    ys <- map read . words <$> getLine
    print $ solve x ys
	
solve :: Int -> [Int] -> Int
solve x ys = min lcost rcost
    where
        ys' = sort ys
        lcost = llen
        rcost = rlen
        llen = length $ takeWhile (<x) ys'
        rlen = len - llen
        len = length ys'
