You have in front of you $n$ stones, each of which is painted in a color, namely the $i$-th stone is painted in color $a_i$.

In one operation, you can choose any two \textbf{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.