347_A. Difference Row
You want to arrange n integers a1, a2, ..., an in some order in a row. Let's define the value of an arrangement as the sum of differences between all pairs of adjacent integers.

More formally, let's denote some arrangement as a sequence of integers x1, x2, ..., xn, where sequence x is a permutation of sequence a. The value of such an arrangement is (x1 - x2) + (x2 - x3) + ... + (xn - 1 - xn).

Find the largest possible value of an arrangement. Then, output the lexicographically smallest sequence x that corresponds to an arrangement of the largest possible value.

Input

The first line of the input contains integer n (2 ≤ n ≤ 100). The second line contains n space-separated integers a1, a2, ..., an (|ai| ≤ 1000).

Output

Print the required sequence x1, x2, ..., xn. Sequence x should be the lexicographically smallest permutation of a that corresponds to an arrangement of the largest possible value.

Examples

Input

5
100 -100 50 0 -50


Output

100 -50 0 50 -100 

Note

In the sample test case, the value of the output arrangement is (100 - ( - 50)) + (( - 50) - 0) + (0 - 50) + (50 - ( - 100)) = 200. No other arrangement has a larger value, and among all arrangements with the value of 200, the output arrangement is the lexicographically smallest one.

Sequence x1, x2, ... , xp is lexicographically smaller than sequence y1, y2, ... , yp if there exists an integer r (0 ≤ r < p) such that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 < yr + 1.
```python
# t=int(input())
# import math
# for _ in range(t):
#     n,k=list(map(int,input().split()))
#     s=input()
#     a=[]
#     summer=0
#     for i in range(len(s)):
#         if(s[i]=='1'):
#             a.append(i)
#     i=0
#     while(i<len(a)-1):
#         dist=a[i+1]-k-1-(a[i]+k+1)+1
#         # print(a,dist)
#         if(dist>0):
#             # summer+=(dist//k)
#             summer+=(math.ceil(dist/(k+1)))
#         i+=1
#     if(len(a)>0):
#         dist=a[0]-k
#         if(dist>0):
#             summer+=(math.ceil(dist/(k+1)))
            
#         dist=n-1-a[-1]-k
#         if(dist>0):
#             summer+=(math.ceil(dist/(k+1)))
#     else:
#         summer+=(math.ceil(n/(k+1)))
        
#     print(summer)
n=int(input())
s=list(map(int,input().split()))
s.sort()
print(s[n-1],end=" ")
for a in s[1:-1]:
    print(a,end =" ")
print(s[0])
```