For example say we have a list of numbers
[0, 0, 4, 7, 3, 3, 7, 7, 7, 9]
0 occurs twice, however 1 & 2 do not occur, but then 3 occurs twice, so on and so forth.
Is there a built in function that would give me
[2, 0, 0, 2, 1, 0, 0, 4, 0, 1]
If not how could I go about incorporating zeros for values that do not occur?