output_description: Print the minimum number of elements that needs to be removed so that a will
  be a good sequence.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      a_1 a_2 ... a_N
attempt: import sys
  
  sys.setrecursionlimit(10**6)
  from math import floor, ceil, sqrt, factorial, log
  from heapq import heappop, heappush, heappushpop
  from collections import Counter, defaultdict, deque
  from itertools import (
      accumulate,
      permutations,
      combinations,
      product,
      combinations_with_replacement,
  )
  from bisect import bisect_left, bisect_right
  from copy import deepcopy
  from operator import itemgetter
  from fractions import gcd
  
  mod = 10**9 + 7
  inf = float("inf")
  ninf = -float("inf")
  
  
  # 整数input
  def ii():
      return int(sys.stdin.readline().rstrip())  # int(input())
  
  
  def mii():
      return map(int, sys.stdin.readline().rstrip().split())
  
  
  def limii():
      return list(mii())  # list(map(int,input().split()))
  
  
  def lin(n: int):
      return [ii() for _ in range(n)]
  
  
  def llint(n: int):
      return [limii() for _ in range(n)]
  
  
  # 文字列input
  def ss():
      return sys.stdin.readline().rstrip()  # input()
  
  
  def mss():
      return sys.stdin.readline().rstrip().split()
  
  
  def limss():
      return list(mss())  # list(input().split())
  
  
  def lst(n: int):
      return [ss() for _ in range(n)]
  
  
  def llstr(n: int):
      return [limss() for _ in range(n)]
  
  
  # 本当に貪欲法か？ DP法では？？
  # 本当に貪欲法か？ DP法では？？
  # 本当に貪欲法か？ DP法では？？
  
  n = ii()
  arr = limii()
  
  mat = Counter(arr)
  ans = 0
  for i, j in mat.items():
      if i <= j:
          ans += j - i
      else:
          ans += j
  print(ans)
  
problem_description: Statement
  
  You are given a sequence of positive integers of length N, a = (a_1, a_2, ...,
  a_N). Your objective is to remove some of the elements in a so that a will be
  a **good sequence**.
  
  Here, an sequence b is a **good sequence** when the following condition holds
  true:
  
    * For each element x in b, the value x occurs exactly x times in b.
  
  For example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are
  good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.
  
  Find the minimum number of elements that needs to be removed so that a will be
  a good sequence.
samples: [{"input": "4\n    3 3 3 3", "output": "1\n    \n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good\nsequence.\n\n* * *"}, {"input": "5\n    2 4 1 4 2", "output": "2\n    \n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good\nsequence.\n\n* * *"}, {"input": "6\n    1 2 2 3 3 3", "output": "0\n    \n\n* * *"}, {"input": "1\n    1000000000", "output": "1\n    \n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\n* * *"}, {"input": "8\n    2 7 1 8 2 8 1 8", "output": "5"}]