Example challenge

Given a sequence of n integers sort them in decreasing order according to the number of their divisors. If some numbers have the same number of divisors sort them in increasing order.


Input

The first line of input contains an integer n. The next line contains n integers from the range 0..109.

Output

The output should contain n numbers in the specified order.


Exemplary input:

10
1 2 3 4 5 6 7 8 9 10

Exemplary output:

6 8 10 4 9 1 2 3 5 7

Sample solutions


function foo(items) { var x = "All this is syntax highlighted"; return x; }