N = int(eval(input()))

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



sort_dict = {}

for i in sort_a_list:

    if i not in list(sort_dict.keys()):

        sort_dict[i] = [i]

    else:

        sort_dict[i].append(i)

        

remove_counter = 0

for key, value in list(sort_dict.items()):

    if len(value) < key:

        remove_counter += len(value)

    elif len(value) == key:

        pass

    else:

        remove_counter +=(len(value) - key)

        

print(remove_counter)
import collections

N = int(eval(input()))

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



sort_dict = collections.Counter(a_list)

remove_counter = 0

for key, value in list(sort_dict.items()):

    if value < key:

        remove_counter += value

    else:

        remove_counter += (value - key)     

print(remove_counter)
N = int(eval(input()))
sort_a_list = sorted(list(map(int, input().split())))
sort_dict = {}
for i in sort_a_list:
    if i not in list(sort_dict.keys()):
        sort_dict[i] = [i]
    else:
        sort_dict[i].append(i)
remove_counter = 0
for key, value in list(sort_dict.items()):
    if len(value) < key:
        remove_counter += len(value)
    elif len(value) == key:
        pass
    else:
        remove_counter += len(value) - key
print(remove_counter)

import collections

N = int(eval(input()))
a_list = list(map(int, input().split()))
sort_dict = collections.Counter(a_list)
remove_counter = 0
for key, value in list(sort_dict.items()):
    if value < key:
        remove_counter += value
    else:
        remove_counter += value - key
print(remove_counter)

+import collections + -sort_a_list = sorted(list(map(int, input().split()))) -sort_dict = {} -for i in sort_a_list: -    if i not in list(sort_dict.keys()): -        sort_dict[i] = [i] -    else: -        sort_dict[i].append(i) +a_list = list(map(int, input().split())) +sort_dict = collections.Counter(a_list) -    if len(value) < key: -        remove_counter += len(value) -    elif len(value) == key: -        pass +    if value < key: +        remove_counter += value -        remove_counter += len(value) - key +        remove_counter += value - key