Let's say that there are people Named 1,2,3,4...
And let us assume all people with odd numbered name gets a white hat and all the people with even numbered name gets a black hat,
And now let's arrange them in a line with all white hatted people adjacent to all the black hatted people,
And it is...