printing number of non-empty nodes in the tree