I was curious myself, and it turns out there were five missions, starting with the one to compensate for the incorrectly ground mirror. IIRC the final one was in doubt, as there was no possibility of a rescue mission in the event of irreparable damage on launch.
The final servicing mission (STS-125) ended up with a contingency plan for damage on launch, STS-400. Another shuttle was prepped and on the pad for a rescue mission if the primary shuttle was damaged.