Problem Description

Sort array values by frequency (desc), and by value (asc) when tie.

Input Format

First n. Next line n integers.

Output Format

One line sorted.

Sample Test Case

Input:
7 4 4 1 2 2 2 3
Output:
2 2 2 4 4 1 3

Constraints

n

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next