A student of z-school found a kind of sorting called z-sort. The array a with n elements are z-sorted if two conditions hold:

  1. ai ≥ ai - 1 for all even i, 
  2. ai ≤ ai - 1 for all odd i > 1. 



For example the arrays [1,2,1,2] and [1,1,1,1] are z-sorted while the array [1,2,3,4] isn’t z-sorted.

Can you make the array z-sorted?

Input

The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of elements in the array a.

The second line contains n integers ai (1 ≤ ai ≤ 109) — the elements of the array a.

Output

If it's possible to make the array a z-sorted print n space separated integers ai — the elements after z-sort. Otherwise print the only word "Impossible".

Examples

Input

4
1 2 2 1


Output

1 2 1 2


Input

5
1 3 2 2 5


Output

1 5 2 3 2
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Zsort {
	public static void main (String[]args) throws IOException {
		BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
		int x = Integer.parseInt(br.readLine());
		String sort = br.readLine();
		StringTokenizer st= new StringTokenizer (sort);
		int a[] = new int [x];
		for (int i =0 ;i<x;i++) {
			a[i]=Integer.parseInt(st.nextToken());
		}
		int [] newarray = new int [x];
		a=mergeSort(a,0,a.length-1);
		int i =0;
		int j =a.length-1;
		for (int m=0;m<newarray.length;m++) {
			if (m%2==0) {
				newarray[m]=a[i];
				i++;
			}
			else {
				newarray[m]=a[j];
				j--;
			}
		}
		
		//if (checker(newarray)) {
			
		if (x%2!=0)
			newarray[x-1]=a[x/2];
		for (int n=0;n<x;n++) {
			if (n==x-1)
				System.out.print(newarray[n]);
			else 
		    System.out.print(newarray[n]+" ");	
		}
		}
		//else 
		//	System.out.println("Impossible");
		//System.out.println(Arrays.toString(newarray));
		
	//}
	public static int[] mergeSort(int []x,int start,int end){
		int mid;
		int i=0;
		int j=0;
		int ii=0;
		if (start==end)
			return new int[] {x[start]};
		mid=(start+end)/2;
		int []left = mergeSort(x,start,mid);
		int []right = mergeSort(x,mid+1,end);
		int []res=new int [end-start+1];
		while (i<left.length&&j<right.length) {
			if (left[i]<=right[j])
				res[ii++]=left[i++];
			else { 
				res[ii++]=right[j++];
				
				}	
		}
		while (i<left.length)
			res[ii++]=left[i++];
		while (j<right.length)
			res[ii++]=right[j++];
		return res;	
		
	}
	public static boolean checker (int[]a) {
		boolean flag=false;
		for (int i=2;i<a.length&&flag==true;i++) {
			if (i%2==0&&a[i]>=a[i-1])
				flag=true;
			else if (i%2!=0&&a[i]<=a[i-1])
				flag = true;
			else flag = false;
		}
		return flag;
	}
}