module Main where

import Control.Applicative
import Data.List

solve :: [Int] -> Int
solve = sum . map subSolve . group . sort
    where subSolve xs@(x:_) | n >= x = n - x
                            | otherwise = n
              where n = length xs

main :: IO ()
main = do
  _ <- getLine
  xs <- map read . words <$> getLine
  print $ solve xs
