13. On the Island of Knights and Rascals, Knights tell the truth except when they are wrong, and Rascals always lie. During a meeting, 40 islanders sit around a large round table, and each one says: "I am next to a Knight and a Rascal." Knowing that 3 Knights present are wrong, how many Knights are at the meeting?
## 13. The answer is $\mathbf{27}$.

Let's start with some basic observations. There cannot be only Knights at the table, because they would all be wrong, not just 3 of them. If we look at a Knave or, equivalently, a Knight who is wrong, next to him sit either two Knaves or two Knights.

Since there is at least one Knave and at least one Knight (actually at least three), there is at least one Knave sitting next to a Knight. In particular, Knaves (assuming there are more than one) cannot sit next to each other, because those "inside" the group could lie, but those on the edge would have one Knave and one Knight neighbor, which is absurd. Therefore, Knaves sit isolated, surrounded by Knights.

Basically, without the Knights who are wrong, we would have a sequence of triplets of the form $C F C$.

Now let's bring in the Knights who are wrong. They can insert themselves between two Knights (for example, between two consecutive triplets, but not only, if there are more than one in a row) or between two Knaves, that is, "eliminating" a Knight, when we look at two consecutive triplets: $C F C C F C$ can be replaced by $C F \bar{C} F C$, where $\bar{C}$ is the Knight who is wrong. In the first case, the number of people at the table increases by 1, in the second it decreases by 1 (two Knights are "transformed" into one Knight).

Let's say there are $a$ Knights who are wrong of the first type, that is, sitting between Knights, and $3-a$ of the second type, that is, between two Knaves. Then at the table there are $40=k \cdot 3+a-(3-a)=3 \cdot(k-1)+2 \cdot a$, with $0 \leq a \leq 3$. Since 40 has a remainder of 1 modulo 3, $2a$ has a remainder of 1 modulo 3, so $a=2$. This means we have two Knights who are wrong surrounded by Knights and one surrounded by Knaves. Before considering the Knights who are wrong, we had 39 people sitting around the table, of which 26 were Knights and 13 were Knaves. We added two Knights (who are wrong) sitting between other Knights, bringing the total number of Knights to 28, after which the third Knight who is wrong took the place of two Knights sitting next to each other and surrounded by Knaves, which reduced the total number of Knights to 27.