#C8476. Arrange Books
Arrange Books
Arrange Books
You are given n books with a respective number of pages. Your task is to sort the list of pages in non-decreasing order and then determine the number of books that have the maximum number of pages.
Mathematically, let the sorted list be \(a_1, a_2, \ldots, a_n\) where \(a_i \leq a_{i+1}\) for every \(1 \leq i < n\), and let \(M = a_n\) be the maximum value. You need to compute the frequency of \(M\) in the list.
Example:
Input: 5 100 200 150 200 100</p>Output: 100 100 150 200 200 2
inputFormat
The input is read from stdin. The first line contains an integer n, representing the number of books. The second line contains n space-separated integers where each integer corresponds to the number of pages in a book.
outputFormat
The output should be written to stdout in two lines. The first line contains the sorted list of pages in non-decreasing order (space-separated). The second line contains the count of books that have the maximum number of pages.
## sample5
100 200 150 200 100
100 100 150 200 200
2
</p>