import Data.List
import Data.Array
import Data.Maybe
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8
 
getInts :: IO [Int]
getInts = (map parseInt . BS8.words) <$> BS.getLine 
    where parseInt = fst . fromJust . BS8.readInt
 
solve :: [Int] -> Int
solve = sum . map calc . group . sort
    where calc xs@(x:_)
            | length xs >= x = length xs - x
            | otherwise = length xs

main :: IO ()
main = do
    [n] <- getInts
    ls <- getInts
    print (solve ls)