MG is a lucky boy. He is always be able to find gold from underground.
It is known that the gold is a sequence with $n$ elements, which has its own color $C$.
MG can dig out a continuous area of sequence every time by using one shovel, but he's unwilling to dig the golds of the same color with one shovel.
As a greedy person, he wish to take all the n golds away with least shovel.
The rules also require MG not to dig twice at the same position.
MG thought it very easy and he had himself disdained to take the job. As a bystander, could you please help settle the problem and calculate the answer?