extending a bit on @mustbe3to20signs' answer:
here is a nice article about the total number of individual T Rexes that ever lived: https://www.nytimes.com/2021/04/15/science/tyrannosaurus-rex-population.html
If the 20,000 number [of concurrently alive individuals] is correct, over the 2.4 million years that T. rex walked the Earth, there would have been a total of some 2.5 billion adults that ever lived.
This is for a single species of dinosaur (T. Rex)!
Next comes the question of how likely it is that a dead T. Rex leaves a skeleton that will be preserved up until our time. Fossilization requires special conditions to be present for many years following the death of the animal, otherwise the skeleton will not be recognizable anymore, after just a relatively short time (as is the case with skeletons in cemeteries for instance where you would expect decomposition to soil within a couple hundred years). Here the article has another huge number:
Only about one out of every 80 million T. Rexes that ever existed was fossilized
Those odds lie somewhere between the chance of a human being bitten by a snake and then dying from it and the chance of winning the lottery. So kind of low, but given the number of T. Rexes that lived it's still a respectable chance.
But what about other large dinosaurs? (ignoring all species that are still around like birds and crocodiles here). If you extrapolate a little bit for the total number of dinosaur species you will soon notice that the likely number of dinosaurs that walked the earth is just so huge it boggles the mind.
from Wikipedia:
In 2016, the estimated number of dinosaur species that existed in the Mesozoic was 1,543–2,468.[25][26]
Lets round that to a nice 2000 species and assume all of those had at least as many individuals as the apex predator T. Rex (most species actually weren't predators so their numbers would have been larger). So we get a number of 5 trillion adult dinosaurs ever. Multiply with the chance of fossilization (simplifying here by assuming the chance is the same for all species which is probably far off but hopefully we are still in the right order of magnitude).: 62500 adult fossilized individuals among all dinosaurs that lived in the Mesozoic assuming they had all very small population numbers, like the T. Rex. If you assume larger populations, like would be expected for herbivores, you could easily get numbers that are 1000 times higher, but the uncertainty is pretty high anyway.