N = int(eval(input()))

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



d = {}

for i in range(N):

  if(A[i] not in d):

    d[A[i]] = 1

  else:

    d[A[i]] += 1

cnt = 0

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

  if(k != v):

    if(k > v):

      cnt += v

    else:

      cnt += v - k

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

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



d = {}

for a in A:

  if(a in d):

    d[a] += 1

  else:

    d[a] = 1

cnt = 0

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

  if(k > v):

    cnt += v

  elif(k < v):

    cnt += v - k

print(cnt)
N = int(eval(input()))
A = list(map(int, input().split()))
d = {}
for i in range(N):
    if A[i] not in d:
        d[A[i]] = 1
    else:
        d[A[i]] += 1
cnt = 0
for k, v in list(d.items()):
    if k != v:
        if k > v:
            cnt += v
        else:
            cnt += v - k
print(cnt)

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

-for i in range(N): -    if A[i] not in d: -        d[A[i]] = 1 +for a in A: +    if a in d: +        d[a] += 1 -        d[A[i]] += 1 +        d[a] = 1 -    if k != v: -        if k > v: -            cnt += v -        else: -            cnt += v - k +    if k > v: +        cnt += v +    elif k < v: +        cnt += v - k