I would like to add a class to menu that shows how many items are in that particular level. I.E.

```
<ul class="menu count-5">
  <li>1</li>
  <li>2</li>
  <li>3</li>
  <li>4</li>
  <li>5</li>
</ul>

```

What's the best way to do this?

I've looked at [theme\_menu\_tree](http://api.drupal.org/api/drupal/includes!menu.inc/function/theme_menu_tree/7) but the tree is already rendered html by that point so there is no easy way to count the number of items.