You are given an array of integers. Write a program to reorder the array as follows:
Place the smallest element at the first position, the next smallest (among the remaining) at the last position, the following smallest at the second position, then the next at the second to last position, and so on, alternating to the middle of the array.
The first line contains the integer (1 \leq n \leq 30000). The second line contains array elements, separated by spaces. Each element's absolute value does not exceed .
Output the resulting array in a single line, elements separated by spaces.
Example 1