#include <bits/stdc++.h>
using namespace std;
void MAZEN() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  MAZEN();
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  for (int i = 0; i < n - 1; i += 2) {
    swap(v[i], v[i + 1]);
  }
  cout << (n - 1) / 2 << endl;
  for (int i = 0; i < n; i++) cout << v[i] << " ";
  return 0;
}
