#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 8;
const double pi = 3.14159265359;
long long binpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
long long inverse(long long x) { return binpow(x, MOD - 2, MOD); }
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (auto& i : a) cin >> i;
  if (n <= 2) {
    cout << 0 << endl;
    for (auto i : a) cout << i << " ";
    return;
  }
  sort((a).begin(), (a).end());
  long long i = 0, j = n - 1;
  long long ok = 1;
  vector<long long> b;
  while (i <= j) {
    if (ok) {
      b.push_back(a[j--]);
      ok = 0;
    } else {
      b.push_back(a[i++]);
      ok = 1;
    }
  }
  long long cnt = 0;
  if (n % 2)
    cnt = n / 2;
  else
    cnt = n / 2 - 1;
  cout << cnt << endl;
  for (auto i : b) cout << i << " ";
  cout << endl;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  solve();
  cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n ";
}
