from collections import Counter



N = int(eval(input()))

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

c = Counter(a)



ans = 0

for key in c:

  if c[key] >= key:

    ans += (c[key] - key)

  else:

    ans += c[key]

print(ans)
N = int(eval(input()))

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



d = {}

for ai in a:

  if ai in d:

    d[ai] += 1

  else:

    d[ai] = 1

  

ans = 0

for key in d:

  if d[key] >= key:

    ans += (d[key] - key)

  else:

    ans += d[key]

print(ans)

from collections import Counter

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

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

-from collections import Counter - -c = Counter(a) +d = {} +for ai in a: +    if ai in d: +        d[ai] += 1 +    else: +        d[ai] = 1 -for key in c: -    if c[key] >= key: -        ans += c[key] - key +for key in d: +    if d[key] >= key: +        ans += d[key] - key -        ans += c[key] +        ans += d[key]