Add level counter to the tree node. Terminal node has level 0.