Add getLeafNodeNum function