It's close!!!!!! But you got the idea already.
You do realise, that the 20th person can only see 19 hats... So its ODD.
What if all hats are black/red? What will the 20th person say????
SO, the correct answer... is to say the ODD number of hats (instead of even). Cuz in 19, no matter how you split, one colour WILL DEFINITELY be ODD and the other will DEFINITELY be EVEN --> NO MATTER HOW ITS SPLIT.
So, the 19th person will see if he can see the odd numbered hats. If he counted them to be odd, he can be sure his hat is NOT that colour because IF his hat is THAT COLOUR, then the 20th person would not have counted an ODD number. So, by alternating Odd and even, the rest of the 19 people will be able to know the colour of their hats
WELL DONE for getting to this point though