N=int(eval(input()))

d={}

ans=0

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

for i in range(N):

    d[a[i]]=0

for i in range(N):

    d[a[i]]+=1

for k in d:

    val=d[k]

    if val>=k:

        ans+=d[k]-k

    else:

        ans+=d[k]

print(ans)

from collections import Counter

N=int(eval(input()))

ans=0

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

d = Counter(a)

for k in d:

    val = d[k]

    if val>=k:

        ans+=val-k

    else:

        ans+=val

print(ans)

N = int(eval(input()))
d = {}
ans = 0
a = list(map(int, input().split()))
for i in range(N):
    d[a[i]] = 0
for i in range(N):
    d[a[i]] += 1
for k in d:
    val = d[k]
    if val >= k:
        ans += d[k] - k
    else:
        ans += d[k]
print(ans)

from collections import Counter

N = int(eval(input()))
ans = 0
a = list(map(int, input().split()))
d = Counter(a)
for k in d:
    val = d[k]
    if val >= k:
        ans += val - k
    else:
        ans += val
print(ans)

+from collections import Counter + -d = {} -for i in range(N): -    d[a[i]] = 0 -for i in range(N): -    d[a[i]] += 1 +d = Counter(a) -        ans += d[k] - k +        ans += val - k -        ans += d[k] +        ans += val