n = int(eval(input()))

L = sorted(map(int, input().split()))

d = {}

for i in range(n):

    if L[i] not in d:

        d[L[i]] = 1

    else:

        d[L[i]] += 1

cnt = 0

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

    if k == v:

        continue

    else:

        if k > v:

            cnt += v

        else:

            cnt += v - k

print(cnt)

from collections import Counter



n = int(eval(input()))

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

c = Counter(a)

ans = 0

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

    if k > v:

        ans += v

    elif k < v:

        ans += v - k

print(ans)

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

from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
ans = 0
for k, v in list(c.items()):
    if k > v:
        ans += v
    elif k < v:
        ans += v - k
print(ans)

+from collections import Counter + -L = sorted(map(int, input().split())) -d = {} -for i in range(n): -    if L[i] not in d: -        d[L[i]] = 1 -    else: -        d[L[i]] += 1 -cnt = 0 -for k, v in list(d.items()): -    if k == v: -        continue -    else: -        if k > v: -            cnt += v -        else: -            cnt += v - k -print(cnt) +a = list(map(int, input().split())) +c = Counter(a) +ans = 0 +for k, v in list(c.items()): +    if k > v: +        ans += v +    elif k < v: +        ans += v - k +print(ans)