#C712. Leaderboard Ranking

    ID: 50956 Type: Default 1000ms 256MiB

Leaderboard Ranking

Leaderboard Ranking

In a programming competition, participants earn scores that determine their rankings. Given a list of scores, your task is to generate a leaderboard which is sorted in descending order, while preserving the relative order of scores that are equal.

More formally, let \(S = [s_1, s_2, \dots, s_n]\) be the list of scores. Then the leaderboard is the list \(L\) that satisfies:

[ L = \text{stable_sort}(S, \text{in descending order}) ]

For example, if the input scores are [90, 100, 100, 85], the correct leaderboard is [100, 100, 90, 85].

inputFormat

The first line of the input contains an integer \(n\) representing the number of scores.

The second line contains \(n\) space-separated integers representing the scores.

outputFormat

Output the leaderboard as \(n\) space-separated integers in descending order while preserving the order of equal elements.

## sample
4
90 100 100 85
100 100 90 85