#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> adj;
vector<int> child;
void solve() {
  long long i, n, a, b;
  cin >> n;
  vector<long long> v(n);
  for (i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  a = 0;
  b = n - 1;
  if (n % 2 == 0) {
    cout << (n / 2 - 1) << endl;
  } else {
    cout << (n / 2) << endl;
  }
  for (i = 0; i < n; i++) {
    if (i % 2 == 1) {
      cout << v[a] << " ";
      a++;
    } else {
      cout << v[b] << " ";
      b--;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  for (int i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
