n = int(eval(input()))

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

dic = {}

count = 0



for i in range(n):

  dic.setdefault(l[i],0)

  dic[l[i]] += 1



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

  if x <= y:

    count += y - x

  else:

    count += y

print(count)

n = int(eval(input()))

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

d = {}

ans = 0

for i in l:

  if i not in d:

    d[i] = 1

  else:

    d[i] += 1

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

  if k != v:

    if k < v:

      ans += v - k

    else:

      ans += v

print(ans)
n = int(eval(input()))
l = list(map(int, input().split()))
dic = {}
count = 0
for i in range(n):
    dic.setdefault(l[i], 0)
    dic[l[i]] += 1
for x, y in list(dic.items()):
    if x <= y:
        count += y - x
    else:
        count += y
print(count)

n = int(eval(input()))
l = list(map(int, input().split()))
d = {}
ans = 0
for i in l:
    if i not in d:
        d[i] = 1
    else:
        d[i] += 1
for k, v in list(d.items()):
    if k != v:
        if k < v:
            ans += v - k
        else:
            ans += v
print(ans)

-dic = {} -count = 0 -for i in range(n): -    dic.setdefault(l[i], 0) -    dic[l[i]] += 1 -for x, y in list(dic.items()): -    if x <= y: -        count += y - x +d = {} +ans = 0 +for i in l: +    if i not in d: +        d[i] = 1 -        count += y -print(count) +        d[i] += 1 +for k, v in list(d.items()): +    if k != v: +        if k < v: +            ans += v - k +        else: +            ans += v +print(ans)