The current official answer from the BBC would be that there have been 14 versions of the Doctor: the First to Eighth Doctors, the "War Doctor", & the Ninth to Thirteenth Doctors. Additionally, there is the possibility that an individual known as the Valyard might have been a future version of the Doctor seen in "The Trial of a Timelord". Also, the Tenth Doctor helped to create two additional different versions of himself in "Journey's End".
However, there are many "unofficial" versions of the Doctor that have been seen in spin-off material, not generally seen as part of the established television "canon". The most prominent is likely the character called "Dr. Who" (portrayed by Peter Cushing) in the 1960s Dalek films. Next in terms of prominence bight be the 9th-13th Doctors seen in the BBC-made spoof, "The Curse of Fatal Death". Then there was the at-the-time-official Ninth Doctor, played by Richard E. Grant, in "Scream of the Shalka" (webcast) — but his "official" status was revoked when the 2005 series identified Christopher Eccleston as the "true" Ninth Doctor.
The Big Finish audio series has posited several "alternative" Doctors in their Doctor Who: Unbound series. And there have been a number of prose works which have likewise posited Doctors who cannot be readily identified as any one that has officially appeared on television.
An exact count of the total number of Doctors who have appeared in BBC-licensed material outside of the main television program would be laborious in the extreme. However, it is probably no exaggeration to say that at least 50 separate Doctors can be identified in material sanctioned by the BBC.
But you have to remember the number of Doctors like in the episode "The Next Doctor" and the episodes with the 10th Doctor in the library, who all seem to be previous or future Doctors.