Renaming all branches of a tree

Hi all, I erased some branches of a tree with split tree node, and now I would like to rename all the brances from 0 to the number of branches is there a way to do it?

for example:

the tree I have:
{6}
{8}
{20}

...

the tree I would like to obrain:
{1}

{2}

{3}