#include <bits/stdc++.h>
const long long N = 5e5 + 5;
const int MOD = 1e9 + 7;
using namespace std;
int n;
int a[N];
long long b[N], c[N];
multiset<long long> s;
void xuly() {
  cin >> n;
  for (int i = (1); i <= (n); ++i) cin >> a[i];
  sort(a + 1, a + 1 + n);
  cout << (n - 1) / 2 << '\n';
  int top2 = n, top1 = 1;
  for (int i = (1); i <= (n); ++i) {
    if (i & 1)
      cout << a[top2--] << " ";
    else
      cout << a[top1++] << " ";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  xuly();
}
