Counting the leaf nodes of a binary tree