finish counting sort
fix bug: reset count after initialization