Maximums to the right#8964

Maximums to the right

1 second
128 megabytes
Very easy

Given array of integers. Move all maximum elements to the end of the array without changing the order of others.

Input

First line contains positive integer . Next line contains integers. All numbers do not exceed by absolute value.

Output

Print the elements of updated array.

Examples

Example 1

Loading
Loading