How is the answer eight, and not nine?
With my strategy the first elf in the row looks at all the nine hats in front of him, and calls out the color an even amount of visible hats has.
Imagine, for example, that the first elf sees six blue hats and three red hats. He says blue.
The second elf sees the eight hats in front of him. He sees five blue ones, and three red ones, and can deduce that because there is an even amount of blue hats among those before him and him, his head must be blue. So every elf after the first is possible to deduce which color his hat must have.
Even the tenth elf, who heard the first elf exclaim blue, and knows there is an even amount of blue hats among the last nine elfs, knows which hat he must have: He heard the first elf say blue, and after that another six blues (even) and two reds: he knows he must be red too.
The first elf doesnt know the color of his hat, yet the other nine do.
So why is nine the wrong answer, and is eight right?