from collections import Counter

N=int(eval(input()))

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

d=Counter(A)

ans=0

for i in d:

  if d[i]>=i:

    ans+=d[i]-i

  else:

    ans+=d[i]

print(ans)
from collections import Counter

n=int(eval(input()))

a=Counter(input().split())

ans=0

for i,j in list(a.items()):

    i=int(i)

    if i>j:

        ans+=j

    elif i<j:

        ans+=j-i

print(ans)
from collections import Counter

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

from collections import Counter

n = int(eval(input()))
a = Counter(input().split())
ans = 0
for i, j in list(a.items()):
    i = int(i)
    if i > j:
        ans += j
    elif i < j:
        ans += j - i
print(ans)

-N = int(eval(input())) -A = list(map(int, input().split())) -d = Counter(A) +n = int(eval(input())) +a = Counter(input().split()) -for i in d: -    if d[i] >= i: -        ans += d[i] - i -    else: -        ans += d[i] +for i, j in list(a.items()): +    i = int(i) +    if i > j: +        ans += j +    elif i < j: +        ans += j - i