Final version of "Counting sort"