D. Dungeon Equilibrium
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

You are developing a new RPG game where each monster species has a peculiar rule about how many times it should appear on a level.

A level is represented by an array of integers $$$a_1, a_2, \ldots, a_n$$$, where each integer represents the type of a monster.

A level is considered balanced if, for every monster type $$$x$$$ that appears, there are exactly $$$x$$$ monsters of that type. For example, a balanced level might have three monsters of type $$$3$$$, five of type $$$5$$$, and so on. An empty level (no monsters at all) is also considered balanced.

Unfortunately, your current level design is not necessarily balanced. You can delete some monsters (i.e., remove elements from the array) to make it balanced.

Given the array $$$a_1, a_2, \ldots, a_n$$$, find the minimum number of monsters you need to remove to make the level balanced.

Input

The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the current number of monsters in the level.

The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq n$$$) — the monster types.

Output

Output a single line containing an integer: the minimum number of monsters you should remove from the level to make it balanced.

Examples
Input
5
1 1 2 2 3
Output
2
Input
10
1 2 3 2 4 4 4 4 5 2
Output
3
Note

Explanation of sample 1. In the first example, you can remove one monster of type $$$1$$$ and one of type $$$3$$$. The level then becomes $$$[1, 2, 2]$$$, which is balanced (it has one monster of type $$$1$$$ and two of type $$$2$$$). You cannot make the level balanced with fewer than $$$2$$$ removals, so the answer is $$$2$$$.

Explanation of sample 2. In the second example, you can make the level $$$[1, 2, 4, 4, 4, 4, 2]$$$.