import qualified Data.IntMap as M
 
main = do
  getLine
  as <- map read . words <$> getLine
  print $ solve as
 
solve = calc . count
 
count as = M.fromListWith (+) $ zip as (repeat 1)
 
calc = M.foldrWithKey op 0
 
op k v s
  | k <= v = s + v - k
  | otherwise = s + v