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