N = int(eval(input()))

A = input().split()

A = [int(a) for a in A]



D = {}



for a in A:

    D[a] = D.get(a, 0) + 1



cnt = 0

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

    if k < v:

        cnt += v - k

    elif v < k:

        cnt += v

print(cnt)

from collections import Counter

N = int(eval(input()))

D = Counter([int(a) for a in input().split()])



cnt = 0

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

    if k < v:

        cnt += v - k

    elif v < k:

        cnt += v

print(cnt)

N = int(eval(input()))
A = input().split()
A = [int(a) for a in A]
D = {}
for a in A:
    D[a] = D.get(a, 0) + 1
cnt = 0
for k, v in list(D.items()):
    if k < v:
        cnt += v - k
    elif v < k:
        cnt += v
print(cnt)

from collections import Counter

N = int(eval(input()))
D = Counter([int(a) for a in input().split()])
cnt = 0
for k, v in list(D.items()):
    if k < v:
        cnt += v - k
    elif v < k:
        cnt += v
print(cnt)

+from collections import Counter + -A = input().split() -A = [int(a) for a in A] -D = {} -for a in A: -    D[a] = D.get(a, 0) + 1 +D = Counter([int(a) for a in input().split()])