Problem 4. Balls.
In one computer game gamer places balls of different colors in one line. When three or more balls with the same color are placed in one chain, they are removed from the line, while the balls are shifted to each other.
Write program that calculates number of balls that will be removed from the line. It is guaranteed that in the beginning there is one or more chain with the three or more balls.
Input contains number of balls N and colors numbered from 0 to 9.
1 3 3 3 2 3
3 3 2 1 1 1 2 2 3 3 10