#include <bits/stdc++.h>
using namespace std;
template <class T>
void printArray(const T* a, int n, ostream& out = cerr);
template <class T>
void printArray(const vector<T>& arr, ostream& out = cerr);
const long long mod = 1e9 + 7;
const double PI = acos(-1);
int n, i, j, k, t;
int a[100002];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  sort(a, a + n);
  printf("%d\n", (n - 1) / 2);
  for (int i = 0, j = 0, k = n / 2; i < n; ++i) {
    if (i & 1) {
      printf("%d ", a[j++]);
    } else {
      printf("%d ", a[k++]);
    }
  }
  puts("");
  return 0;
}
template <class T>
void printArray(const T* a, int n, ostream& out) {
  for (int i = 0; i < n; ++i) {
    out << a[i] << " ";
  }
  out << endl;
}
template <class T>
void printArray(const vector<T>& arr, ostream& out) {
  for (const T& x : arr) {
    out << x << " ";
  }
  out << endl;
}
