nleaves function

Counts the number of leaves in a tree