Recently, the first model of decoration was assembled from multi-colored glowing light bulbs at the holiday jewelry factory. The prototype of the decoration was assembled as follows:
The result was a decoration of colored light bulbs. The factory has bulbs of different colors. When the prototype was ready, it was handed over to the Beauty Department. In this department, it was decided to consider the beauty of jewelry the number of pairs of light bulbs of the same color, connected by a wire.
Employees of the Beauty Department repaint some of the light bulbs in one of the colors for some reason known only to them. All they need to produce the perfect jewelry is to quickly determine the beauty of the product, after repainting the next light bulb.
The staff of the beauty department asks you, the best programmer, to write a program that will determine the beauty of jewelry according to the given prototype of jewelry and the sequence of repainting light bulbs.
Input format
Output format
Print lines. The line should contain a single integer denoting the number of pairs of light bulbs of the same color, connected by a wire, after execution and repainting.
Constraints
In the first case, all bulbs are connected in a chain (first-second-third) and have different colors. Then they are repainted in the same color. First, a pair of light bulbs 1 2 becomes a single color (the second light bulb is repainted in color 1), and then 2 3 (the third light bulb is repainted in color 1). After repainting the second bulb in the color of 2 single-color pairs of bulbs connected by a wire, does not remain.