To just get totals, use [the `total` filter][1].  
For example: [/2.2/badges?site=stackoverflow&filter=total][2], 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][3].

Note that you can set the pagesize up to 100.  See [the doc page for badges][4].


  [1]: https://api.stackexchange.com/docs/filters
  [2]: https://api.stackexchange.com/2.2/badges?site=stackoverflow&filter=total
  [3]: https://api.stackexchange.com/docs/wrapper
  [4]: https://api.stackexchange.com/docs/badges#pagesize=100&site=stackoverflow