8.5. In Nastya's room, 16 people gathered, each pair of whom either are friends or enemies. Upon entering the room, each of them wrote down the number of friends who had already arrived, and upon leaving - the number of enemies remaining in the room. What can the sum of all the numbers written down be, after everyone has first arrived and then left?
Answer: 120

Solution: Consider any pair of friends. Their "friendship" was counted exactly once, as it is included in the sum by the person who arrived later than their friend. Therefore, after everyone has arrived, the sum of the numbers on the door will be equal to the total number of friendships between people. Similarly, each "enmity" will be counted exactly once by the person who left earlier. Therefore, after everyone has left, the sum of the numbers on the door will be increased by the sum of all "enmities." In total, the overall sum of the numbers on the door will be equal to the sum of the total number of friendships and enmities, which is precisely the number of pairs of people who arrived, i.e., $16 * 15 / 2 = 120$.

Criteria: answer only - 0 points.