6. In the village of Asip, all inhabitants belong to one of the two following groups: the Knights, who always tell the truth, and the Liars, who always lie. Today, for the annual census, the Grand Notary has arrived from the capital, and all the inhabitants line up in front of him. Each of them states: "The number of those who do not belong to my group and are in front of me is even." In addition to this, the first three inhabitants in the line state, in order, the following: "There are 999 inhabitants in the village," "The Knights are exactly 666," "There are at least three Liars in Asip." How many Knights are there in Asip?
(A) 0
(B) 1
(C) 501
(D) 666
(E) 997
6. The answer is (E). First, we observe that the first person in line, in front of whom there are 0 people, must necessarily be a Knight, because they always tell the truth. Therefore, there are 999 inhabitants in Asip, and at least one of them is a Knight. Let's focus on the statement regarding parity: the second person can be either a Knight (since there are 0 Liars in front of them) or a Liar (since there is a Knight in front of them). In both cases, however, the third person in line is of the same group as the second. This also applies to the inhabitants further back in line: those in an even position have an odd number of Knights and an even number of Liars in front of them and can therefore be a member of either group; those in an odd position, on the other hand, are necessarily of the same group as the person in front of them. This tells us, in particular, that the Liars are in an even number. Let's then look at the other two statements made by the second and third persons in line: since they are of the same group, they either both tell the truth or both lie. In the first case, we would have 666 Knights and 333 Liars (compatible with at least three), but this is not possible because the Liars must be in an even number. Suppose, then, that they are both Liars; in this case, they are the only Liars, otherwise the third person in line would be telling the truth. Therefore, all the other 997 inhabitants are Knights.

Second solution. As above, the inhabitants are 999. Suppose the second person in line is a Knight: in this case, the total number of Knights would be 666 and the number of Liars 333. Consider then the last person in line: if this were a Knight, they would see 333 Liars in front of them, which is impossible (because they would be lying); but it cannot be a Liar either, because in that case they would see 666 Knights in front of them. It follows that the second inhabitant in line is lying, so they are a Liar, and therefore the person behind them must also lie (seeing an odd number of Liars and an odd number of Knights in front of them). The Liars are therefore at most two; in fact, the configuration in which all except the second and third in line are Knights (for a total of 997 Knights and two Liars) is consistent with the statements of the inhabitants.