from collections import Counter



n=int(eval(input()))

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

a_s=list(set(a))

c_l=Counter(a)



cnt=0

for i in a_s:

    if c_l[i]<i:

        cnt+=c_l[i]

    else:

        cnt+=c_l[i]-i

print(cnt)
from collections import Counter



n=int(eval(input()))

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

a_s=list(set(a))

c_l=Counter(a)



cnt=0

for i in a_s:

    cnt+=c_l[i] if c_l[i]<i else c_l[i]-i

print(cnt)
from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
a_s = list(set(a))
c_l = Counter(a)
cnt = 0
for i in a_s:
    if c_l[i] < i:
        cnt += c_l[i]
    else:
        cnt += c_l[i] - i
print(cnt)

from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
a_s = list(set(a))
c_l = Counter(a)
cnt = 0
for i in a_s:
    cnt += c_l[i] if c_l[i] < i else c_l[i] - i
print(cnt)

-    if c_l[i] < i: -        cnt += c_l[i] -    else: -        cnt += c_l[i] - i +    cnt += c_l[i] if c_l[i] < i else c_l[i] - i