liwi likes a specific type of sequence. He likes an array with length
if it meets the following conditions:
- For each element
in
,
must occur exactly
times.
You are given an array with length
. liwi wants you to remove the minimum number of elements such that the result is a sequence liwi likes.
For example, ,
,
are all valid sequences liwi likes.
Constraints
,
is a positive integer
For 20% of the points, , and
.
Input Specification
The first line will contain a single integer, .
The next line of input will contain space separated integers,
, such that
.
Output Specification
You are to output a single integer - the minimum number of elements that need to be removed such that the array becomes a sequence liwi likes.
Sample Input 1
5
1 2 2 3 1
Sample Output 1
2
Comments