Added leaf nodes counter. All tests pass