#include <bits/stdc++.h>
using namespace std;
template <typename... T>
inline void inp(T &...args) {
  ((cin >> args), ...);
}
template <typename T>
inline istream &operator>>(istream &in, vector<T> &a) {
  for (auto &x : a) in >> x;
  return in;
}
template <typename T, typename U>
inline istream &operator>>(istream &in, pair<T, U> &a) {
  in >> a.first >> a.second;
  return in;
}
void solve(int &T) {
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  cin >> a;
  sort((a).begin(), (a).end());
  vector<long long int> b(n, -1);
  long long int id = 0;
  for (long long int i = (1); (((1) <= (n) ? 1 : -1) > 0 ? i < (n) : i > (n));
       i += ((1) <= (n) ? 1 : -1)) {
    b[i++] = a[id++];
  }
  for (long long int i = (0); ((1) > 0 ? i < (n) : i > (n)); i += (1)) {
    if (b[i] == -1) {
      b[i] = a[id++];
    }
  }
  cout << (n / 2) - (n % 2 == 0) << '\n';
  for (auto &X : b) {
    cout << X << " ";
  }
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  for (int i = 1; i <= t; i++) {
    if (0) cerr << "Case #" << i << "\n";
    solve(i);
  }
  return 0;
}
