7.1 On the Island of Truth and Lies, there are knights who always tell the truth, and liars who always lie. One day, 20 residents of the island lined up by height (from tallest to shortest, the tallest being the first) for a game. Each had to say one of the following phrases: "There is a liar below me" or "There is a knight above me." In the end, those standing from the third to the seventh position said the first phrase, while the rest said the second. How many knights were among these 20 people, given that all residents have different heights?
Answer: 17

Solution. The formation cannot consist of only liars (in such a case, the 3-7th person would be telling the truth). Consider the tallest knight, let's call him P. He could only say the first phrase, so the 1st and 2nd places must be occupied by liars, and P stands from the 3rd to the 7th place. Moreover, there is a liar who is shorter than P, let's call him L. This liar cannot say the second phrase, so he must say the first phrase and stand no later than the 7th place, but not earlier than the 4th place. Therefore, from the 8th to the 20th place, only knights stand. The 3rd place cannot be occupied by a liar, as there is a liar L who is shorter than him. Therefore, the 3rd place is occupied by P. If there are other liars between P and L, they must also say the first phrase, but L is shorter than them, which is a contradiction.

Thus, liars stand at the 1st, 2nd, and 7th places, while the remaining places are occupied by knights.