You are given N distinct natural numbers. Using every number exactly once, arrange them into a sawtooth (zigzag) sequence.
A sequence is sawtooth-shaped when the order relation of each pair of adjacent elements alternates. That is, it must satisfy one of the two forms below:
Several sawtooth sequences may be possible from the given numbers. Output the lexicographically smallest one. When comparing two sequences lexicographically, the sequence with the smaller value at the first position where they differ is the smaller one.
The first line contains the count of numbers N. The second line contains the N distinct natural numbers ai, separated by spaces.
On the first line, print the lexicographically smallest sawtooth sequence that uses all of the given numbers, separated by spaces. (Both forms above are considered as candidates.)