N = int(eval(input()))

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

A = sorted(A)

cnt = 0

cur = 0

for i in range(1,N):

    if A[i]!=A[i-1]:

        a = A[i-1]

        if i-cur>=a:

            cnt += i-cur-a

        else:

            cnt += i-cur

        cur = i

a = A[-1]

if N-cur>=a:

    cnt += N-cur-a

else:

    cnt += N-cur

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

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

C = {}

cnt = 0

for i in range(N):

    a = A[i]

    if a>N:

        cnt += 1

    else:

        if a not in C:

            C[a]=0

        C[a] += 1

for a in C:

    if a>C[a]:

        cnt += C[a]

    elif a<C[a]:

        cnt += C[a]-a

print(cnt)
N = int(eval(input()))
A = list(map(int, input().split()))
A = sorted(A)
cnt = 0
cur = 0
for i in range(1, N):
    if A[i] != A[i - 1]:
        a = A[i - 1]
        if i - cur >= a:
            cnt += i - cur - a
        else:
            cnt += i - cur
        cur = i
a = A[-1]
if N - cur >= a:
    cnt += N - cur - a
else:
    cnt += N - cur
print(cnt)

N = int(eval(input()))
A = list(map(int, input().split()))
C = {}
cnt = 0
for i in range(N):
    a = A[i]
    if a > N:
        cnt += 1
    else:
        if a not in C:
            C[a] = 0
        C[a] += 1
for a in C:
    if a > C[a]:
        cnt += C[a]
    elif a < C[a]:
        cnt += C[a] - a
print(cnt)

-A = sorted(A) +C = {} -cur = 0 -for i in range(1, N): -    if A[i] != A[i - 1]: -        a = A[i - 1] -        if i - cur >= a: -            cnt += i - cur - a -        else: -            cnt += i - cur -        cur = i -a = A[-1] -if N - cur >= a: -    cnt += N - cur - a -else: -    cnt += N - cur +for i in range(N): +    a = A[i] +    if a > N: +        cnt += 1 +    else: +        if a not in C: +            C[a] = 0 +        C[a] += 1 +for a in C: +    if a > C[a]: +        cnt += C[a] +    elif a < C[a]: +        cnt += C[a] - a