n=int(eval(input()))

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

num.sort()



i,cnt,ans=1,1,0

m=num[0]

while i<n:

    if num[i]==m:

        cnt+=1

    else:

        if cnt<m:

            ans+=cnt

        elif cnt>m:

            ans+=cnt-m

        m=num[i]

        cnt=1

    i+=1

if cnt<m:

  ans+=cnt

elif cnt>m:

  ans+=cnt-m

print(ans)
from collections import Counter

n=int(eval(input()))

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



dic=Counter(num)

ans=0

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

  if k<v:

    ans+=v-k

  elif v<k:

    ans+=v

print(ans)
n = int(eval(input()))
num = list(map(int, input().split()))
num.sort()
i, cnt, ans = 1, 1, 0
m = num[0]
while i < n:
    if num[i] == m:
        cnt += 1
    else:
        if cnt < m:
            ans += cnt
        elif cnt > m:
            ans += cnt - m
        m = num[i]
        cnt = 1
    i += 1
if cnt < m:
    ans += cnt
elif cnt > m:
    ans += cnt - m
print(ans)

from collections import Counter

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

+from collections import Counter + -num.sort() -i, cnt, ans = 1, 1, 0 -m = num[0] -while i < n: -    if num[i] == m: -        cnt += 1 -    else: -        if cnt < m: -            ans += cnt -        elif cnt > m: -            ans += cnt - m -        m = num[i] -        cnt = 1 -    i += 1 -if cnt < m: -    ans += cnt -elif cnt > m: -    ans += cnt - m +dic = Counter(num) +ans = 0 +for k, v in list(dic.items()): +    if k < v: +        ans += v - k +    elif v < k: +        ans += v