On a horizontal line, one colors points red and, to the right of them, points blue. On every move, one chooses two points of different color, such that there is exactly one colored point between them, and interchanges the colors of the chosen points. How many different configurations can one obtain using these moves?
Solution
Enumerate the colored points by positive integers from the left to the right. Every move can influence two points with the same parity, whereby the total number of red or blue points with this parity does not change. Thus in each configuration that can be achieved there are red and blue points with each parity. The number of such configurations is since there are possibilities to choose red points from among points with an odd number and possibilities to choose red points from among points with an even number.
On the other hand, all configurations with red and blue points with each parity can be achieved. Consider the points with even numbers. The number of the rightmost point with an even number that must become red is at least ; after moving the rightmost in the initial configuration red point to the right until it reaches its desired position, this point and all points in the right of it are of the desired color. Next we can move the rightmost red point that is not yet at its desired position similarly to its desired position, etc. When all red points with an even number are at their desired position, other points with an even number are also of the right color. Similarly we act with points with an odd number.