#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, x, i, j, k = 1, w = 1;
  cin >> n;
  long long int a[n + 1], b[n + 1], c[n + 1];
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);
  if (n % 2 != 0) {
    x = n / 2;
  } else {
    x = n / 2 - 1;
  }
  for (i = n, j = 1; i > n / 2, j <= n / 2; i--, j++) {
    b[k++] = a[i];
    c[w++] = a[j];
  }
  cout << x << endl;
  if (n % 2 == 0) {
    for (i = 1; i <= n / 2; i++) {
      cout << b[i] << " " << c[i] << " ";
    }
    cout << endl;
  } else {
    for (i = 1; i <= n / 2; i++) {
      cout << b[i] << " " << c[i] << " ";
    }
    cout << a[n / 2 + 1];
    cout << endl;
  }
}
