Sorting/counting sort & General/Maximum permutaion problem