There are seven named ghosts in the books
- Nearly Headless Nick: Gryffindor House Ghost
- The Fat Friar: Hufflepuff House Ghost
- Helena Ravenclaw: Ravenclaw House Ghost
- The Bloody Baron: Slytherin House Ghost
- Professor Binns: History of Magic teacher
- Moaning Myrtle: Basilisk victim
- Sir Patrick: Head of the Headless Hunt
We also know that there are at least 20 that are around continually.
About twenty ghosts had just streamed through the back wall. Pearly-white and slightly transparent, they glided across the room talking to each other and hardly glancing at the first-years.
Philosopher's Stone - Chapter 7: The Sorting Hat
And potentially upwards of hundreds.
The dungeon was full of hundreds of pearly-white, translucent people, mostly drifting around a crowded dance floor, waltzing to the dreadful, quavering sound of thirty musical saws, played by an orchestra on a black-draped platform.
Chamber of Secrets - Chapter 8: The Deathday Party
(Though some of the attendees may have been invited from outside Hogwarts)
And then of course you have Peeves, who while not a ghost, is certainly spectral.