Not crazy about that solution. There's a better one, I think. Prisoner #100 counts the red hats he can see. If the number is odd, he says "Red"; if it's even, he says "Blue." That tells #99 whether the number of red hats remaining is odd or even. #99 then counts red hats. If the number he sees is the same Mod 2 as #100, he knows that he is not wearing a red hat, because, if he were, he would see one less red hat than #100 saw and the odd/even tally would change. So Prisoner #99 knows what color his hat is, which makes his guess correct. By counting the red hats accurately determined behind him (ignoring#100) and visible ahead of him, each successive prisoner can know the color of his hat.