import collections



N = int(eval(input()))

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



c = collections.Counter(A)



ans = 0

for i in set(A):

    if i > c[i]:

        ans += c[i]

    if i < c[i]:

        ans += (c[i] -i)

print(ans)
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

    else:

        ans += (v-k)



print(ans)
import collections

N = int(eval(input()))
A = list(map(int, input().split()))
c = collections.Counter(A)
ans = 0
for i in set(A):
    if i > c[i]:
        ans += c[i]
    if i < c[i]:
        ans += c[i] - i
print(ans)

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

-import collections +from collections import Counter -A = list(map(int, input().split())) -c = collections.Counter(A) +a = list(map(int, input().split())) +c = Counter(a) -for i in set(A): -    if i > c[i]: -        ans += c[i] -    if i < c[i]: -        ans += c[i] - i +for k, v in list(c.items()): +    if k > v: +        ans += v +    else: +        ans += v - k