Bell
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Write a program that in array of n integers put smallest element to the first place, the smallest of the remaining - to the last, the next smallest - to the second place, the next - to the second to the last place, and so on - until the middle of the array.
Input
The first line contains number n (1 ≤ n ≤ 30000). The second line contains n array elements, each is no more than 32767 by absolute value.
Output
Print in one line the array elements.
Examples
Input #1
Answer #1
Submissions 4K
Acceptance rate 46%