100 mathematicians somehow went to the prison. The cunning guard decided to have a little fun with the math geeks. He proposed a game, he would put a black or white hat on the head of every mathematician, and then line them up in height order, that is, the tallest one on the back, and the smallest one in the front; such that every person sees the heads (or hats) of everybody in front of him/her.
The warden will then ask everybody the color of their own hat. Every person gets freed if he answers correctly, or viciously murdered otherwise. The mathematicians may gather around to form a strategy before the hats are assigned, but no other communication may take place after that, except the fact that every person hears the answers of his precedents in the line.
Could you form a strategy that saves the maximum number of the mathematicians? For instance, if everybody were to say randomly white or black, then the expectancy of the saved mathematicians is 50%. Can you improve on that?
Hint: there is a rather trivial way to achieve 75%. There is a non-trivial way to achieve 99% worst-case, and 99.5% in expectancy.