I need to put some formal statistics on the document itself somewhere in the middle, like "This document contains XXX figures and YYY tables (and may be even ZZZ formulas and PPP theorems)". Is there a common way to output the final value of some counter in the middle of the document?
Edited after answering: I have asked a more specific question before, "How to output the number of bibliographic entries referenced in the document?", which is now deleted because the answer to this one covers also this case.
For the reference, some useful counters, which can be used with totcount:
page- page count
enumiv- bibliography entries count
figure- figures count
table- tables count