n = int(eval(input()))

arr = []

out = {}



input = input().split(" ")

for i in input:

	arr.append(int(i))

	

	if out.get(arr[-1], False):

		out[arr[-1]] += 1

	else:

		out[arr[-1]] = 1



count = 0

for key in out:

	if key > out[key]:

		count += out[key]

	else:

		count += out[key] - key



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

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



d = {}

for i in range(0,N):

    e = seq[i]

    if e not in list(d.keys()):

        d[e] = 1

    else:

        d[e] += 1



r = 0

for k in list(d.keys()):

    v = d[k]

    if (v < k):

        r += v

    else:

        r += v-k



print(r)

n = int(eval(input()))
arr = []
out = {}
input = input().split(" ")
for i in input:
    arr.append(int(i))
    if out.get(arr[-1], False):
        out[arr[-1]] += 1
    else:
        out[arr[-1]] = 1
count = 0
for key in out:
    if key > out[key]:
        count += out[key]
    else:
        count += out[key] - key
print(count)

N = int(eval(input()))
seq = list(map(int, input().split()))
d = {}
for i in range(0, N):
    e = seq[i]
    if e not in list(d.keys()):
        d[e] = 1
    else:
        d[e] += 1
r = 0
for k in list(d.keys()):
    v = d[k]
    if v < k:
        r += v
    else:
        r += v - k
print(r)

-n = int(eval(input())) -arr = [] -out = {} -input = input().split(" ") -for i in input: -    arr.append(int(i)) -    if out.get(arr[-1], False): -        out[arr[-1]] += 1 +N = int(eval(input())) +seq = list(map(int, input().split())) +d = {} +for i in range(0, N): +    e = seq[i] +    if e not in list(d.keys()): +        d[e] = 1 -        out[arr[-1]] = 1 -count = 0 -for key in out: -    if key > out[key]: -        count += out[key] +        d[e] += 1 +r = 0 +for k in list(d.keys()): +    v = d[k] +    if v < k: +        r += v -        count += out[key] - key -print(count) +        r += v - k +print(r)