from collections import Counter

a = int(eval(input()))

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

#i = 1



c=Counter(l)

d = dict(c)

kv = []

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

    if k>v:

        kv.append(v)

    elif k<v:

        t = v-k

        kv.append(t)

s = sum(kv)

print(s)

n = int(eval(input()))

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

ans = 0

cnt = [0] * n + [0]

for i in a:

  if i > n:

    ans += 1

  else:

    cnt[i] += 1

for i in range(n + 1):

  ans += cnt[i] - i if cnt[i] >= i else cnt[i]

print(ans)
from collections import Counter

a = int(eval(input()))
l = list(map(int, input().split()))
# i = 1
c = Counter(l)
d = dict(c)
kv = []
for k, v in list(d.items()):
    if k > v:
        kv.append(v)
    elif k < v:
        t = v - k
        kv.append(t)
s = sum(kv)
print(s)

n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
cnt = [0] * n + [0]
for i in a:
    if i > n:
        ans += 1
    else:
        cnt[i] += 1
for i in range(n + 1):
    ans += cnt[i] - i if cnt[i] >= i else cnt[i]
print(ans)

-from collections import Counter - -a = int(eval(input())) -l = list(map(int, input().split())) -# i = 1 -c = Counter(l) -d = dict(c) -kv = [] -for k, v in list(d.items()): -    if k > v: -        kv.append(v) -    elif k < v: -        t = v - k -        kv.append(t) -s = sum(kv) -print(s) +n = int(eval(input())) +a = list(map(int, input().split())) +ans = 0 +cnt = [0] * n + [0] +for i in a: +    if i > n: +        ans += 1 +    else: +        cnt[i] += 1 +for i in range(n + 1): +    ans += cnt[i] - i if cnt[i] >= i else cnt[i] +print(ans)