Counting-and-Sorting