Added node counting utility to TreeNode.