To print counts , simply print the number of times n was added at index corresponding to every element
for ( let i = 0 ; i < n ; i ++ ) document . write ( ( i + 1 ) + " " + parseInt ( arr [ i ] / n , 10 ) + " " ) ; }