Solution. We will prove that there cannot be more than 15 sages. Suppose the opposite, that there are at least 16 sages. Sequentially number all the sages. Consider nine consecutive sages. If we add one of the two neighboring sages to them, then among them there will be an equal number of sages with white and black hats, so on any sages, between whom there are 9 sages, hats of the same color are worn.

Without loss of generality, let the first sage wear a black hat. Then the eleventh sage also wears a black hat. If the twelfth sage wears a white hat, then among the first twelve sages there will be an equal number of white and black hats. Therefore, the twelfth sage wears a black hat, from which it follows that the second sage also wears a black hat. Similarly, considering the sages from the second to the eleventh, we get that the third and thirteenth sages wear black hats. Considering the sages from the third to the twelfth, we get that the fourth and fourteenth sages wear black hats. Similarly, the fifth and fifteenth, and the sixth and sixteenth sages wear black hats. But then among the first ten sages, the first six wear black hats, so there will be more black hats. Contradiction.

15 sages can be: let the first 5 and the last 5 sages wear black hats, and the remaining 5 wear white hats. It is easy to see that the condition of the problem will be satisfied.

Criteria. Any correct solution: 7 points.

Proved that there cannot be more than 15 sages, but no example is given of how to put the hats on 15 sages: 6 points.

Proved that on two sages, between whom stand 9 sages, hats of the same color are worn, but further reasoning is missing or incorrect: 2 points.

An example of arranging 15 sages that satisfies the condition is given, but it is not proved that more sages cannot be placed: 1 point.

Only the correct answer is given: 0 points.
6. (7 points) Several sages lined up in a column. All of them wore either black or white caps. It turned out that among any 10 consecutive sages, there were an equal number of sages with white and black caps, while among any 12 consecutive sages - not an equal number. What is the maximum number of sages that could be

Answer: 15 sages.