import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

sys.setrecursionlimit(10 ** 7)



from collections import Counter



n = int(readline())

a = tuple(map(int, readline().split()))

memo = tuple(Counter(a).items())

ans = 0

for x, y in memo:

    if x <= y:

        ans += y - x

    else:

        ans += y

print(ans)

import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

sys.setrecursionlimit(10 ** 7)



from collections import Counter



n, *a = list(map(int, read().split()))

ans = 0

for k, v in list(Counter(a).items()):

    if k > v:

       ans += v

    elif k < v:

        ans += v - k

print(ans)

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
from collections import Counter

n = int(readline())
a = tuple(map(int, readline().split()))
memo = tuple(Counter(a).items())
ans = 0
for x, y in memo:
    if x <= y:
        ans += y - x
    else:
        ans += y
print(ans)

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
from collections import Counter

n, *a = list(map(int, read().split()))
ans = 0
for k, v in list(Counter(a).items()):
    if k > v:
        ans += v
    elif k < v:
        ans += v - k
print(ans)

-n = int(readline()) -a = tuple(map(int, readline().split())) -memo = tuple(Counter(a).items()) +n, *a = list(map(int, read().split())) -for x, y in memo: -    if x <= y: -        ans += y - x -    else: -        ans += y +for k, v in list(Counter(a).items()): +    if k > v: +        ans += v +    elif k < v: +        ans += v - k