#include <bits/stdc++.h>
using namespace std;
long long n, m, x, cnt, a;
const long long N = 1e5 + 7;
vector<long long> d(N);
string s, s1;
int main() {
  cin >> n;
  vector<int> v, v1;
  for (int i = 0; i < n; i++) {
    cin >> a, v.push_back(a);
  }
  sort(v.begin(), v.end());
  cout << n / 2 - (n % 2 == 0) << endl;
  for (int i = 0; i < n / 2; i++) {
    v1.push_back(v[n - i - 1]);
    v1.push_back(v[i]);
  }
  if (n % 2) v1.push_back(v[n / 2]);
  for (auto it : v1) cout << it << " ";
}
