2. On an island, there live liars and knights, a total of 2021 people. Knights always tell the truth, and liars always lie. Every resident of the island knows whether each person is a knight or a liar. One fine day, all the residents of the island lined up. After that, each resident of the island stated: "The number of liars standing to the right of me is greater than the number of knights standing to the left of me." How many knights are there on the island? Provide all possible options and prove that there are no others.
Answer: 1010

Solution. The rightmost islander cannot be telling the truth, since there is no one to the left of him, and in particular, there are no liars. Therefore, he is a liar. The leftmost islander cannot be lying, since there is at least one liar to the left of him, and there is no one to the right of him, and in particular, there are no knights. Therefore, he is a knight. Temporarily remove these two from the row. For all the others, the number of liars to the right and the number of knights to the left has decreased by one, so the truthfulness and falsity of their statements have not changed. Therefore, by repeating the same reasoning, we establish that the rightmost islander is a liar, and the leftmost is a knight. Remove the two outermost islanders again, and continue this process until only one resident remains. He is lying and therefore is a liar. Thus, in the middle of the row stands a liar, all to the right of him are also liars, and all to the left of him are knights. Therefore, there are 1010 knights.