#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << "\n";
  err(++it, args...);
}
ll modlaber(ll a, ll m = 1000000007) { return ((a + m) % m + m) % m; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll n;
  cin >> n;
  vector<ll> v(n);
  for (auto &x : v) cin >> x;
  sort(begin(v), end(v));
  reverse(begin(v), end(v));
  cout << (n - 1) / 2 << "\n";
  cout << v[0] << ' ';
  for (int i = 1; i < n; i++) {
    if (i == n - 1)
      cout << v[i] << ' ';
    else
      cout << v[i + 1] << ' ' << v[i] << ' ', i++;
  }
  cout << "\n";
  return 0;
}
