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.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class A {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		//Scanner sc = new Scanner("in.txt");
		PrintWriter out = new PrintWriter(System.out);
		int x=sc.nextInt();
		int[]a=new int[x];
		for(int i=0;i<x;i++)
			a[i]=sc.nextInt();
		Arrays.sort(a);
		int j=a.length-1;
		int k=0;
		int[] b=new int[x];
		for(int i=0;i<x;i++) {
			if(i%2==0)
				b[i]=a[k++];
			else 
				b[i]=a[j--];
			
		}
		for(int i=0;i<x;i++) {
			out.print(b[i]+" ");
		}
		out.flush();
		out.close();
	}
	
	static int sort(int arr[])
	{
		return divide(arr, 0, arr.length - 1);
	}
	
	static int divide(int arr[], int beg, int end)
	{
		if(beg == end) return 0;
		int mid = ((beg + end) >> 1);
		int inv = 0;
		inv += divide(arr, beg, mid);
		inv += divide(arr, mid + 1, end);
		inv += conquer(arr, beg, mid, end);
		return inv;
	}
	
	static int conquer(int arr[], int beg, int mid, int end)
	{
		int inv = 0;
		int len = end - beg + 1;
		int a[] = new int[mid - beg + 1];
		int b[] = new int[end - mid];
		for(int i = 0; i < a.length; ++i) a[i] = arr[beg + i];
		for(int i = 0; i < b.length; ++i) b[i] = arr[mid + 1 + i];
		int i, j, k;
		i = j = k = 0;
		
		while(k < len)
		{
			if(i == a.length) arr[beg + k++] = b[j++];
			else if(j == b.length)
				arr[beg + k++] = a[i++];
			else if(a[i] > b[j])
			{
				arr[beg + k++] = b[j++];
				inv += (a.length - i);
			}
			else arr[beg + k++] = a[i++];
		}
		return inv;
	}
	
	static class Pair implements Comparable<Pair>
	{
		long money;
		int age;
		
		public Pair(long x, int y) {
			money = x;
			age = y;
		}
		public int compareTo(Pair p) {
			if(Long.compare(money, p.money) == 0)
				return Integer.compare(age, p.age);
			return Long.compare(p.money, money);
		}
		public String toString() {
			return "Money: "+money+" "+"Age: "+age;
		}
	}
	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		public Scanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}

		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

		int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		boolean ready() throws IOException {
			return br.ready();
		}
	}
}
