Each of the Entrez databases supports the “all” filter term which returns the total number of records indexed in a database. You can also collect this information using an E-utilities URL, e.g.:
eutils.ncbi.nlm.nih.gov/entrez/eutils/egquery.fcgi?term=all[filter]