#arc087a. [arc087_a]Good Sequence
[arc087_a]Good Sequence
Problem Statement
You are given a sequence of positive integers of length , . Your objective is to remove some of the elements in so that will be a good sequence.
Here, an sequence is a good sequence when the following condition holds true:
- For each element in , the value occurs exactly times in .
For example, , and (an empty sequence) are good sequences, while and are not.
Find the minimum number of elements that needs to be removed so that will be a good sequence.
Constraints
- is an integer.
Input
Input is given from Standard Input in the following format:
Output
Print the minimum number of elements that needs to be removed so that will be a good sequence.
Sample Input 1
4
3 3 3 3
Sample Output 1
1
We can, for example, remove one occurrence of . Then, is a good sequence.
Sample Input 2
5
2 4 1 4 2
Sample Output 2
2
We can, for example, remove two occurrences of . Then, is a good sequence.
Sample Input 3
6
1 2 2 3 3 3
Sample Output 3
0
Sample Input 4
1
1000000000
Sample Output 4
1
Remove one occurrence of . Then, is a good sequence.
Sample Input 5
8
2 7 1 8 2 8 1 8
Sample Output 5
5