Think of it this way: each smurf only needs to know the even or odd "count" for each color to make his decision.
Ex: distribution unknown:
The smurf 100 calls out the odd color he sees before him - blue. All each smurf in line needs to do then is keep up with is the even or odd count for blue.
For example, say it is smurf 47's turn and blue has been called an odd (x) number of time previously. Smurf 47 then counts how many blue hats
he sees before him. If y is odd then x+y=even. Since he knows there must be an odd number of hats, he knows his hat is blue. Likewise, if y=even, then x+y=odd, and he knows his hat can not be blue.