from collections import Counter



N = int(eval(input()))

A = [int(i) for i in input().split()]



ans = 0

for k, v in list(Counter(A).items()):

    if k > v:

        ans += v

    else:

        ans += v - k

print(ans)
from collections import *

eval(input())

print((sum(v if k>v else v-k for k,v in list(Counter(list(map(int,input().split()))).items()))))
from collections import Counter

N = int(eval(input()))
A = [int(i) for i in input().split()]
ans = 0
for k, v in list(Counter(A).items()):
    if k > v:
        ans += v
    else:
        ans += v - k
print(ans)

from collections import *

eval(input())
print(
    (
        sum(
            v if k > v else v - k
            for k, v in list(Counter(list(map(int, input().split()))).items())
        )
    )
)

-from collections import Counter +from collections import * -N = int(eval(input())) -A = [int(i) for i in input().split()] -ans = 0 -for k, v in list(Counter(A).items()): -    if k > v: -        ans += v -    else: -        ans += v - k -print(ans) +eval(input()) +print( +    ( +        sum( +            v if k > v else v - k +            for k, v in list(Counter(list(map(int, input().split()))).items()) +        ) +    ) +)