#C8966. Sort Books by Pages

    ID: 53006 Type: Default 1000ms 256MiB

Sort Books by Pages

Sort Books by Pages

Given a list of books with their respective number of pages, the task is to sort the list in non-decreasing order. The sorting should be stable, meaning that if two books have the same number of pages, their relative order in the input must be preserved.

More formally, let \(a_1, a_2, \dots, a_n\) be the page counts of the books. You need to output the sequence sorted so that \(a_{i_1} \le a_{i_2} \le \cdots \le a_{i_n}\), where the order of indices \(i_1, i_2, \dots, i_n\) preserves the original ordering for equal elements.

inputFormat

The input is given via standard input. The first line contains a single integer \(n\) (\(0 \le n \le 10^5\)), representing the number of books. The second line contains \(n\) space-separated integers, where each integer represents the number of pages in a book.

outputFormat

Output via standard output a single line containing \(n\) space-separated integers representing the sorted list of page counts in non-decreasing order. If \(n = 0\), output an empty line.

## sample
5
100 200 100 300 200
100 100 200 200 300

</p>