Let's call the three wisest men from the kingdom 'A', 'B', and 'C'. And let's say that 'A' was the man that knew he had a dot on his head.
'A' could see that 'B' and 'C' had dots on their hats. So, if 'A' didn't have a dot on his hat, 'B' would think to himself...
"I can see that 'A' does not...