5.1. 40 people came into a room where there were 40 chairs, black and white, and sat on them. All of them said they were sitting on black chairs. Then they somehow resat, and exactly 16 claimed they were sitting on white chairs. Each of those sitting either lied both times or told the truth both times. How many of them lied the second time and were sitting on black chairs?
Answer: 8

Solution. Initially, everyone who told the truth sat on black chairs, and everyone who lied sat on white ones. After some of them switched chairs, 16 claimed they were sitting on white chairs. Obviously, this group includes those who told the truth and were sitting on white chairs, and those who switched with them - they lied and were sitting on black chairs. Since their numbers are equal, exactly half of them - 8 - lied and were sitting on black chairs.