Keep track of the number of nodes in a tree.