import bisect



n = int(eval(input()))

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

c = 0

temp = 0

for i in sorted(list(set(A))):

  d = bisect.bisect_right(A, i)

  if d-temp >= i:

    c += d-temp - i

  else:

    c += d-temp

  temp = d

print(c)
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 v >= k:

    ans += v-k

  else:

    ans += v

print(ans)
import bisect

n = int(eval(input()))
A = sorted(list(map(int, input().split())))
c = 0
temp = 0
for i in sorted(list(set(A))):
    d = bisect.bisect_right(A, i)
    if d - temp >= i:
        c += d - temp - i
    else:
        c += d - temp
    temp = d
print(c)

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 v >= k:
        ans += v - k
    else:
        ans += v
print(ans)

-import bisect +from collections import Counter -A = sorted(list(map(int, input().split()))) -c = 0 -temp = 0 -for i in sorted(list(set(A))): -    d = bisect.bisect_right(A, i) -    if d - temp >= i: -        c += d - temp - i +A = list(map(int, input().split())) +C = Counter(A) +ans = 0 +for k, v in list(C.items()): +    if v >= k: +        ans += v - k -        c += d - temp -    temp = d -print(c) +        ans += v +print(ans)