EditorialSort in nondecreasing order in O(NlogN)O(N\log N)O(NlogN) time. Simple comparisons and swaps also suffice. Values remain within the input range.