For large finite sets where there is no explicit formula for the size, one can often devise a randomized algorithm that approximately counts the size by simulating Markov chains on the set and on recursively defined subsets.
"Approximate Counting via Markov Chains." Statist. Sci. 8 (1) 16 - 19, February, 1993. https://doi.org/10.1214/ss/1177011078