9.7. A green chameleon always tells the truth, while a brown chameleon lies and immediately turns green after lying. In a company of 2019 chameleons (green and brown), each in turn answered the question of how many of them are currently green. The answers were the numbers $1,2,3, \ldots, 2019$ (in some order, not necessarily in the order listed above). What is the maximum number of green chameleons that could have been there initially? (R. Zhenedarov, O. Dmitriev)
Answer: 1010.

Solution. Consider two chameleons who spoke in a row. One of them was brown at the moment of speaking; indeed, if both were green, the number of green chameleons would not have changed after the first one spoke, and the second one would have named the same number as the first. We can divide all the chameleons into 1009 pairs who spoke in a row, and one more chameleon; since in each pair there was a brown one, the initial number of green chameleons was no more than $2019-1009=1010$.

It remains to show that there could have been 1010 green chameleons. Let's number the chameleons in the order of their statements. Suppose all the odd-numbered chameleons are green, and all the even-numbered ones are brown. Then the first one will say 1010, the second one will say 1 and turn green. Then the third one will say 1011, and the fourth one will say 2 and turn green, and so on. As a result, the odd-numbered chameleons will say all the numbers from 1010 to 2019, and the even-numbered ones will say all the numbers from 1 to 1009.

Remark. From the first paragraph of the solution, it can be deduced that in any optimal example, the chameleons with even numbers must be exactly brown.

Comment. Only proving that the number of green chameleons was no more than $1010-4$ points.

Only providing an example showing that there could have been exactly 1010 green chameleons initially - 3 points.