Competitions

# Sort & Search

# Bell

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.

Input example #1

5 1 2 3 4 5

Output example #1

1 3 5 4 2