Function numberOfLeaves