19
I am pretty sure that it is not the best solution but how about this?
numbering[x_] := Block[{n = 0}, Replace[x, y_ :> {++n, y}, {-1}]]
Some example outputs:
In[1]:= numbering[{a, b, {c, d}, e, {f, {g, h}}}]
Out[1]= {{1, a}, {2, b}, {{3, c}, {4, d}}, {5, e}, {{6, f}, {{7, g}, {8, h}}}}
I...