#ABC470B. 单色 / Monocolor
单色 / Monocolor
Problem Statement
There are balls. Each ball is painted in one of colors: color through color . The color of the -th ball is .
In one operation, you can change the color of any one ball to any of the colors.
Find the minimum number of operations required to make all the balls the same color.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
$N$
$C_1$ $C_2$ $\ldots$ $C_N$
Output
Output the answer.
4
3 1 2 1
2
By changing the color of the first ball to and the color of the third ball to , you can make all the balls the same color.
It is impossible to make all the balls the same color by changing the colors of fewer than two balls, so output .
5
3 3 3 3 3
0
All balls may have the same color from the beginning.
9
4 2 3 3 4 1 2 7 1
7
相关
在下列比赛中: