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
//package codeforces;

import java.util.Scanner;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.TreeMap;
import java.util.TreeSet;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Stack;
import java.util.Set;

public class q {
	// Integer.bitCount(i); count no of 1 bit in a given number
	static Scanner scn = new Scanner(System.in);
	static int mod = 1000000007, min = Integer.MAX_VALUE;

	public static void main(String[] args) {
		/* TODO Auto-generated method stub */
		// System.out.format("%.10f", ans);char c = sc.next().charAt(0);
		//code
		
			int n=scn.nextInt();
			int arr[]=new int[n];
			for(int i=0;i<n;i++)
				arr[i]=scn.nextInt();
			Arrays.parallelSort(arr);
			int i=0,j=n-1;
			StringBuilder sb=new StringBuilder();
			while(i<=j)
			{	if(i!=j)
				{
				sb.append(arr[i]+" ");
				sb.append(arr[j]+" ");
				}
			else if(i==j)
				sb.append(arr[i]+" ");
				i++;
				j--;
			}
			System.out.println(sb.toString());
			
		
	}
	public static boolean prime(long n)
	{	boolean bl=true;
		for(int i=2;i<=Math.sqrt(n);i++)
		{
			if(n%i==0||n%(n/i)==0)
			{
				bl=false;
				return bl;
			}
		}
		return bl;
	}
	public static  class Pair implements Comparable {
		int x;
		int y;
		int z;

		Pair(int x, int y, int z) {
			this.x = x;
			this.y = y;
			this.z = z;
		}

		public int compareTo(Object o) {
			Pair pp =  (Pair)o;
			if (pp.x == x)
				return 0;
			else if (x > pp.x)
				return 1;
			else
				return -1;
		}

		
	}

}
