import Control.Monad
import Control.Applicative
import Data.List
import Data.Array
strToInt s = (read :: String -> Int) s
f (a,_,_) = a
s (_,b,_) = b
t (_,_,c) = c

main = do
   n <- readLn :: IO Int
   an <- map strToInt . words <$> getLine
   let bn = group  $ sort an
   print (solve bn)


solve :: [[Int]] -> Int
solve [] = 0
solve (a:an) = if (length a) - (head a) >= 0
               then (length a) - (head a) + (solve an)
               else (length a) + (solve an)