N = int(eval(input()))

A = list(map(int,input().split()))

B = (10**5+1)*[0]

ans = 0



for a in A:

  if a<=10**5:

    B[a]+=1

  else:

    ans+=1



for n in range(10**5):

  if B[n]<n:

    ans+=B[n]

  elif n<B[n]:

    ans+=B[n]-n



print(ans)
from collections import *

N = int(eval(input()))

C = Counter(list(map(int,input().split())))

ans = 0



for k,v in list(C.items()):

  if k<v:

    ans+=v-k

  elif v<k:

    ans+=v



print(ans)
N = int(eval(input()))
A = list(map(int, input().split()))
B = (10**5 + 1) * [0]
ans = 0
for a in A:
    if a <= 10**5:
        B[a] += 1
    else:
        ans += 1
for n in range(10**5):
    if B[n] < n:
        ans += B[n]
    elif n < B[n]:
        ans += B[n] - n
print(ans)

from collections import *

N = int(eval(input()))
C = Counter(list(map(int, input().split())))
ans = 0
for k, v in list(C.items()):
    if k < v:
        ans += v - k
    elif v < k:
        ans += v
print(ans)

+from collections import * + -A = list(map(int, input().split())) -B = (10**5 + 1) * [0] +C = Counter(list(map(int, input().split()))) -for a in A: -    if a <= 10**5: -        B[a] += 1 -    else: -        ans += 1 -for n in range(10**5): -    if B[n] < n: -        ans += B[n] -    elif n < B[n]: -        ans += B[n] - n +for k, v in list(C.items()): +    if k < v: +        ans += v - k +    elif v < k: +        ans += v