Flawed logic. The answer is infinity-1.

No one has EXACTLY 517 hairs. But you can have someone with 0, 1, 2,...516, 518.... eleventy billion... infinite

So given that your question allows for infinite hairs, there can be infinity-1 people.

Nooo! Look:

For a minute, let's pretend the "No person has exactly 518 hairs" condition DOESN'T EXIST.

If there were 519 people, no-one could have more than 518 hairs.

Each of the 519 people must have between 0 and 518 hairs.

No two people can have the same amount...

And there are only 519 possible values between (and including) 0 and 518

So this works....but every value has been used.

BUT...

We bring back the condition.

The value "518" cannot be used...

So if there were 519 people, let's count all the possible integers from 0 to 518

**not including**518.

Oh.

*Now there are only 518 possible values.*

518 values for 519 people...

And "518" is gone for good...

So there will be 519 values for 520 people -- doesn't work.

And 520 values for 521 people -- doesn't work.

And 1000000 values for 1000001 people -- doesn't work.

**Therefore, you cannot go past 518.**