#C4301. Wave Sort

    ID: 47825 Type: Default 1000ms 256MiB

Wave Sort

Wave Sort

You are given an array of integers. Your task is to rearrange the array into a wave-like pattern. The required pattern is defined as follows:

$$a_0 \geq a_1 \leq a_2 \geq a_3 \leq a_4 \dots$$

One common approach to achieve this is to first sort the array and then swap every two adjacent elements. Your program should read input from stdin and output the result to stdout.

inputFormat

The first line of input contains an integer N, representing the number of elements in the array. The second line contains N space-separated integers.

outputFormat

Output a single line containing the rearranged array in wave form. The numbers should be separated by a single space.

## sample
6
3 6 5 10 7 20
5 3 7 6 20 10