counts and displays the leaf nodes