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
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long int C(int n, int k) {
  long long ans = 1;
  k = k > n - k ? n - k : k;
  int j = 1;
  for (; j <= k; j++, n--) {
    if (n % j == 0) {
      ans *= n / j;
    } else if (ans % j == 0) {
      ans = ans / j * n;
    } else {
      ans = (ans * n) / j;
    }
  }
  return ans;
}
long long int powmod(long long int a, long long int b) {
  long long int res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  if (a == 0)
    return (b);
  else
    return (gcd(b % a, a));
}
long long int powmod(long long int a, long long int b, long long int m) {
  long long int res = 1;
  a %= m;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
  }
  return res;
}
int countSetBits(long long int n) {
  unsigned int count = 0;
  while (n) {
    n &= (n - 1);
    count++;
  }
  return count;
}
int members[100010];
int a[100010];
void init(int n) {
  for (int i = 0; i <= n; i++) {
    a[i] = i;
    members[i] = 1;
  }
}
int rootof(int x) {
  if (a[x] != x) {
    a[x] = rootof(a[x]);
  }
  return a[x];
}
void unite(int x, int y) {
  x = rootof(x);
  y = rootof(y);
  if (x != y) {
    if (members[x] < members[y]) {
      swap(x, y);
    }
    a[y] = x;
    members[x] += members[y];
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort((a).begin(), (a).end());
  for (int i = 0; i < n / 2; i++) {
    cout << a[i] << " " << a[n - i - 1] << " ";
  }
  if (n & 1) {
    cout << a[n / 2] << '\n';
  }
  return 0;
}
