Sakurako and a Christmas Array
Sakurako has recently decorated an array in a way that it became a Christmas array. It was glorious, until Chefir came and messed it up.
An array of length is called glorious if the following holds:
for every ;
and there is an element which occurs more than times.
You are given an array of length , where is even. You are asked what is the minimum amount of elements that you need to replace in order for this array to become glorious.
A "replace" means that you can choose any and assign where is an arbitrary integer (even if does not exist in the array).
Input
The first line contains a single integer (; is even), which denotes the length of the array.
The second line contains integers .
Output
In a single line, output a single integer, which denotes the minimum amount of elements that need to be replaced in order for to become a glorious array.
Examples
Note
Optimal replacement sequence in test case 1:
For this array both conditions hold:
for each
integer occurs more than times in our array.
We can show that this is the minimal amount of operations that we need to make.
In test case 2 the optimal replacement is:
It can be shown that this is the smallest amount of operations that we need to do.
Scoring
You will receive at least points if your solution works correctly for for every .
You will receive at least points if your solution works correctly for for every .
You will receive at least points if your solution works correctly for .
You will receive additional points if your solution works correctly without any restrictions.