To just get totals, use the total
filter.
For example: /2.2/badges?site=stackoverflow&filter=total, which currently returns:
{"total":6363}
If you want both the badges and the total, you can set a custom filter, or just count the members of the items
array as you page through them. The latter option is less expensive in the API and thus less likely to get you backoff
warnings.
Note that you can set the pagesize up to 100. See the doc page for badges.