#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 5;
const double EPS = 1e-9;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &i : a) cin >> i;
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  vector<int> res(n);
  int sol = 0;
  for (int i = 1; i < n; i += 2) {
    res[i] = a.back();
    a.pop_back();
    sol++;
  }
  for (int i = 0; i < n; i += 2) {
    res[i] = a.back();
    a.pop_back();
  }
  cout << sol - (n % 2 ? 0 : 1) << '\n';
  for (auto i : res) cout << i << ' ';
  cout << '\n';
}
