import Data.List
main :: IO ()
main = do
    _ <- getLine
    ls <- fmap read . words <$> getLine :: IO [Int]
    let ls' = (\n -> (head n,length n)) <$> (group . sort) ls
    print $ foldl' (\current -> \(n,count)-> if n > count then current + count else current + (count - n)) 0 ls'
