n = int(eval(input()))

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

set_a = list(set(list_A))

dic_A = dict()



for i in range(len(set_a)):

    j = str(set_a[i])

    dic_A[j] = 0



for i in list_A:

    j = str(i)

    dic_A[j] += 1

ans = 0

for s, i in list(dic_A.items()):

    c = int(s)

    if i >= c:

        ans += i - c

    else:

        ans += i



print(ans)
from collections import Counter

n = int(eval(input()))

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

l = Counter(list_A)

ans = 0

for s, i in list(l.items()):

    if i >= s:

        ans += i - s

    else:

        ans += i



print(ans)
n = int(eval(input()))
list_A = list(map(int, input().split()))
set_a = list(set(list_A))
dic_A = dict()
for i in range(len(set_a)):
    j = str(set_a[i])
    dic_A[j] = 0
for i in list_A:
    j = str(i)
    dic_A[j] += 1
ans = 0
for s, i in list(dic_A.items()):
    c = int(s)
    if i >= c:
        ans += i - c
    else:
        ans += i
print(ans)

from collections import Counter

n = int(eval(input()))
list_A = list(map(int, input().split()))
l = Counter(list_A)
ans = 0
for s, i in list(l.items()):
    if i >= s:
        ans += i - s
    else:
        ans += i
print(ans)

+from collections import Counter + -set_a = list(set(list_A)) -dic_A = dict() -for i in range(len(set_a)): -    j = str(set_a[i]) -    dic_A[j] = 0 -for i in list_A: -    j = str(i) -    dic_A[j] += 1 +l = Counter(list_A) -for s, i in list(dic_A.items()): -    c = int(s) -    if i >= c: -        ans += i - c +for s, i in list(l.items()): +    if i >= s: +        ans += i - s