from collections import Counter

N = int(eval(input()))

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

ans = 0

for x, y in list(A.items()):

  if y >= x:

    ans += y - x

  else:

    ans += y

print(ans)
from collections import Counter

n = int(eval(input()))

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

ans = 0

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

    if k > v:

        ans += v

    elif k < v:

        ans += v - k



print(ans)

from collections import Counter

N = int(eval(input()))
A = Counter(list(map(int, input().split())))
ans = 0
for x, y in list(A.items()):
    if y >= x:
        ans += y - x
    else:
        ans += y
print(ans)

from collections import Counter

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

-N = int(eval(input())) +n = int(eval(input())) -for x, y in list(A.items()): -    if y >= x: -        ans += y - x -    else: -        ans += y +for k, v in list(A.items()): +    if k > v: +        ans += v +    elif k < v: +        ans += v - k