Four Hats

Three hats puzzle image

Question:

Four hostage mathematicians have been burried up to their necks (as above) such that they can't turn their heads! Their captors say that they will be set free if someone can say what colour their own hat is. They can't say anything but the correct answer or they get killed.

Each guy only knows the colour of the hat(s) he can see and that of the 4 hats, 2 are red and 2 are blue.
Nobody can see through the wall between the 3rd and 4th hostages.

How do they get the right answer with 100% certainty and escape alive?!

Answer: (click to show)

The first guy on the left can see one red and one blue hat. This doesn't help him as his could still be either. If he saw two of the same colour then he'd immediately be able to say his own colour was the opposite.

The two men facing the wall can't see anything, so with no clue they stay silent.

So, because of prologed silence of the first man, the second man knows his hat must differ from the one in front of him. He can confidently say that his hat is red and they all get set free.