eolymp
bolt
Try our new interface for solving problems
Problems

Sort positive and negative

Sort positive and negative

Sequence of integers is given. Sort the given sequence so that first the positive numbers are arranged in descending order, and then the negative numbers are arranged in ascending order. Zeroes should be placed at the end of the sequence.

Input

First line contains amount of numbers n (1n1000). Second line contains n integer, each no more than 2 * 109 by absolute value.

Output

Print in one line a sequence of numbers ordered according to the given condition.

Time limit 1 second
Memory limit 128 MiB
Input example #1
8
9 0 3 -6 0 -5 4 -7
Output example #1
9 4 3 -7 -6 -5 0 0 
Author Michael Medvediev