#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> v;
  for (int i = 0; i < n; i++) {
    long long temp;
    cin >> temp;
    v.push_back(temp);
  }
  sort(v.begin(), v.end());
  if (n & 1)
    cout << n / 2 << endl;
  else
    cout << (n / 2) - 1 << endl;
  if (n % 2 == 0)
    for (int i = n - 1; i >= n / 2; i--) {
      cout << v[i] << " " << v[n - 1 - i] << " ";
    }
  else {
    for (int i = n - 1; i > n / 2; i--) {
      cout << v[i] << " " << v[n - 1 - i] << " ";
    }
    cout << v[n / 2] << " ";
  }
  cout << endl;
  return 0;
}
