from collections import Counter 

n = int(eval(input()))

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

c = Counter(l)

ans = 0

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

    if k < v:

        ans += v - k

    elif k > v:

        ans += v

print(ans)
from collections import Counter

N = int(eval(input()))

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

ca = Counter(a)

ans = 0

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

    if v < k:

        ans += v

    elif v > k:

        ans += v-k

print(ans)
from collections import Counter

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

from collections import Counter

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

-n = int(eval(input())) -l = list(map(int, input().split())) -c = Counter(l) +N = int(eval(input())) +a = list(map(int, input().split())) +ca = Counter(a) -for k, v in list(c.items()): -    if k < v: +for k, v in list(ca.items()): +    if v < k: +        ans += v +    elif v > k: -    elif k > v: -        ans += v