Problem 6. A row of new recruits stood facing the sergeant. On the command "left," some turned left, while the rest turned right. It turned out that six times more soldiers were looking at the back of their neighbor than in the face. Then, on the command "about face," everyone turned in the opposite direction. Now, seven times more soldiers were looking at the back of their neighbor than in the face. How many soldiers are in the row?

$[8$ points] (A. V. Shipovalov)
Answer: 98.

Solution. Let's assume that the sergeant lined up the soldiers between two posts. After the first command, each recruit either looks at the back of the neck of the neighbor or at the face, except for the two soldiers at the ends, who can look at the posts.

If a soldier is looking at the back of the neck of a neighbor, then after the turn, this neighbor will be looking at the back of the neck of the first soldier. Therefore, the number of those looking at the back of the neck will not change.

The soldier at the end, who was looking at the post, will not be doing so after the turn; conversely, if he was not looking at the post, he will be after the turn. Thus, the number of those looking at the post will either remain the same (was 1 and will remain 1), or increase by 2 (was 0, will become 2), or decrease by 2 (was 2, will become 0).

Since the total number of soldiers is constant, the number of those looking at the face will also either remain the same, or increase or decrease by 2.

According to the problem, the number of soldiers looking at the face was initially one-sixth of the number looking at the back of the neck, and then one-seventh. This means that their number decreased (and, therefore, decreased by 2). On the other hand, it changed by $1/6 - 1/7 = 1/42$ of the constant number of those looking at the back of the neck. That is, there were $2 \cdot 42 = 84$ people looking at the back of the neck, and 14 people looking at each other before the turn, which is $84: 6 = 14$. There were no soldiers looking at the posts. Thus, the total number of recruits is $84 + 14 = 98$.