method for counting leaves