count-leaves using accumulate
count-leaves using accumulate