import Data.List
 
(|>) :: a -> (a -> b) -> b
infixl 1 |>
x |> f = f $! x
 
($>) :: (Functor m) => m a -> (a -> b) -> m b
infixl 1 $>
x $> f = fmap f $! x

calc :: [Int] -> Int
calc xs
    | len >= num = len - num
    | otherwise  = len
    where len = length xs
          num = head xs

main = do
    getLine
    ax <- getLine $> words $> map read :: IO [Int]
    ax |> sort |> group |> map calc |> sum |> print