With all of the discussion on this one, it surprises me no one caught this. Why did no one notice that the "No inhabitant has exactly 518 hairs" does not specify that those hairs need to be on their head? When you take this into account, you can have an infinite number of body and head hair combinations, as long as they don't equal 518. Therefore, this puzzle does not have an answer because it grows to infinity.
Example:
I am bald. I am the only bald guy in town.
I have 1000 hairs on my palms.
This meets the both Criteria 1 and Criteria 2 unless I am mistaken.
Criteria 3 states that (inhabitants > number of hair on a person).
Therefore the number of inhabitants in my example is any number greater than 1000.
Correct me if I am wrong, but I do not think that I am.
actually, there was 1 person in the village who had some hair (of his dog) left on his head ... I forgot to mention that as well ... and now I remember, one old lady had a wig (from not her own hair)