Now update count array so that count[d] is the index in the array where the first number with digit d should go in sorted order for the position for this pass.
Just update count like this starting with d = 0:
count[d] = count[d] + count[d - 1]
old updated
a count count
0 412 0 0 0
1 012 1 1 1
2 101 2 2 3
3 432 3 4 7
4 302 4 0 7
5 201 5 0 7
6 410 6 0 7
. . .
. . .
9 0 7
Note that index 7 is out of bounds. But for this pass the position is the least significant digit (position 0) and only the digits 0, 1, and 2 occur.