n = int(eval(input()))

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

d = {}



for a in l:

  if a in d:

    d[a] += 1

  else:

    d[a] = 1



ans = 0

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

  if k > v:

    ans += v

  elif k < v:

    ans += v-k

  else:

    pass

print(ans)

n = int(eval(input()))

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



from collections import Counter

C = Counter(A)

ans = 0

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

    if v < k:

        ans += v

    elif v > k:

        ans += (v-k)

print(ans)

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

n = int(eval(input()))
A = list(map(int, input().split()))
from collections import Counter

C = Counter(A)
ans = 0
for k, v in list(C.items()):
    if v < k:
        ans += v
    elif v > k:
        ans += v - k
print(ans)

-l = list(map(int, input().split())) -d = {} -for a in l: -    if a in d: -        d[a] += 1 -    else: -        d[a] = 1 +A = list(map(int, input().split())) +from collections import Counter + +C = Counter(A) -for k, v in list(d.items()): -    if k > v: +for k, v in list(C.items()): +    if v < k: -    elif k < v: +    elif v > k: -    else: -        pass