import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as MP
import Data.Char

step m x = MP.insertWith (+) x 1 m

step' acc k v
    | k > v = acc + v
    | otherwise = acc + (v - k)

main = do
    n <- readLn :: IO Int
    as <- VU.unfoldrN n (B.readInt . B.dropWhile isSpace) <$> B.getLine
    print $ MP.foldlWithKey step' 0 $ VU.foldl' step MP.empty as