Please comment your solutions, questions and remarks..
Consider a prison with several millions prisoners. The head of the prison arranges the following challenge to the prisoners. One prisoner at a time will be called to a room with a lamp. The lamp is always on or off and the prisoner may change the state of the lamp or leave it as it was. Every hour a randomly picked prisoner is called to the room. Whenever a prisoner is in the room, he or she may say “now everybody have been in this room”. If this prisoner is right, everybody get freedom. If not, the game stops immediately and everybody are hanged. What is the strategy for the prisoners to agree, before the challenge starts, so that they all get freedom with probability 1?