The solution doesn't relate the number of black hats to red hats, but each colour to an odd or even number. I think that's the biggest problem people have with understanding this riddle. The solution takes into account any situation: be it 20 black hats, 20 red hats, or any other combination.