Counting sort template