Task 2. At a party, 100 people arrived, some of whom know each other. All acquaintances are mutual, and no new acquaintances are made during the party.

During the party, the gong struck a hundred times. After the first strike, all those who do not know anyone else among the remaining participants leave. After the second strike, all those who know exactly one of the remaining participants leave. After the third strike, all those who know exactly two of the remaining participants leave. This continues similarly - after the $k$-th strike, all those who know exactly $k-1$ people still at the party leave. Finally, after the hundredth strike, all those who know exactly 99 of the remaining participants leave. In the end, $n$ people remain. What values can the number $n$ take?
Solution. We will prove that $n$ can be $0,1,2,3, \ldots, 98$. First, we describe the situation where exactly $n$ people remain after the last gong strike.

For $n>0$, divide all 100 people into groups $A$ and $B$. Let group $A$ contain $n$ people who know all 99 other participants. Group $B$ contains $100-n$ people who do not know each other but know all the people in group $A$ (so each person in group $B$ has $n$ acquaintances).

After the $(n+1)$-th gong strike, all people in group $B$ leave, which means the people in group $A$ still have exactly $n-1$ acquaintances. Since the $n$-th gong strike has already passed, it follows that all people in group $A$ will remain until the end of the party.

The value $n=0$ is achieved when everyone knows each other (so everyone will leave after the 100th gong strike).

It is easy to notice that $n<100$ because the person with the fewest acquaintances must leave the party.

Finally, we show that $n=99$ is not possible. Assume the contrary, i.e., that exactly one person $X$ leaves the party before the end. As before, this person has the fewest acquaintances. Since no one else has left after $X$, we conclude that everyone knows $X$ - if some person $Y$ does not know $X$, then the number of people $Y$ knows does not change with $X$'s departure, so $Y$ would also have to leave at some point. This shows that $X$ has 99 acquaintances, and thus everyone else also has 99 acquaintances, which is a contradiction.