Painting stones
You have in front of you stones, each of which is painted in a color, namely the -th stone is painted in color .
In one operation, you can choose any two adjacent stones and paint them in any same color.
You need all the stones to become the same color with the minimum number of operations.
Input
The first line contains one integer — the number of stones.
The second line contains integers — the colors of the stones.
Output
Output a single number — the minimum number of operations.
Examples
Note
In the first test, the stones are painted in colors respectively.
For the first operation, you can paint the stones at positions in color , after which the stones will be .
For the second operation, you can paint the stones at positions in color . Now the stones are painted in .
For the last operation, you can paint the last two stones in color , after which all the stones will be of the same color ().
Scoring
In this problem, there are conditional blocks. If your solution works correctly for certain constraints, it will receive a certain number of points. Note that the evaluation is still in progress.
( points): the number of different numbers among all is not more than ;
( points): ;
( points): without additional constraints.