There are 100 prisoners in line. They randomly put a blue or red hat on each one.
Each prisoner can see the hats of everyone in front of him, but not his own or those behind him. Starting with the last person in the line (who sees 99 hats), each one must say out loud 'blue' or 'red'.
If he guesses the color of his hat correctly, he is saved. They can come up with a strategy beforehand.
What is the maximum number of prisoners that can guarantee being saved and what is the strategy that allows them to achieve it?