#include <bits/stdc++.h>
using namespace std;
vector<int> res;
vector<int> ans;
int main() {
  vector<int> v;
  int m, c;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    cin >> c;
    v.push_back(c);
  }
  sort(v.begin(), v.end());
  res.resize(m);
  int k = 0;
  int i = 0, j = m - 1;
  bool l = true;
  while (i <= j) {
    if (l)
      res[i++] = v[k++];
    else
      res[j--] = v[k++];
    l = !l;
  }
  ans.push_back(res[0]);
  for (int i = 1; i < res.size(); ++i) {
    if (res[i] != res[i - 1]) {
      ans.push_back(res[i]);
    }
  }
  cout << ans.size() << endl;
  cout << ans[0];
  for (int i = (int)1; i < (int)ans.size(); ++i) cout << " " << ans[i];
  cout << endl;
  return 0;
}
