#include <bits/stdc++.h>
using namespace std;
template <class C>
void mini(C &a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C &a4, C b4) {
  a4 = max(a4, b4);
}
template <class C>
ostream &operator<<(ostream &os, vector<C> v) {
  os << "[";
  for (auto t : v) {
    os << t << ",";
  }
  os << "]";
  return os;
}
template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> p) {
  return os << "(" << p.first << "," << p.second << ")";
}
void odbij(pair<long long, long long> &p) { p.second = -p.second; }
void odbij(vector<pair<long long, long long> > &v) {
  for (pair<long long, long long> &p : v) {
    odbij(p);
  }
}
pair<long long, long long> &operator-=(pair<long long, long long> &lhs,
                                       const pair<long long, long long> &rhs) {
  lhs.first -= rhs.first;
  lhs.second -= rhs.second;
  return lhs;
}
const pair<long long, long long> operator-(
    pair<long long, long long> lhs, const pair<long long, long long> &rhs) {
  lhs -= rhs;
  return lhs;
}
long long sum(vector<long long> &pref, long long a, long long b) {
  return pref[b + 1] - pref[a];
}
long double f(vector<long long> &pref, vector<long long> &inp, long long x,
              long long l) {
  long long n = ((long long)(inp).size());
  long double score1 =
      inp[x] + sum(pref, x - l, x - 1) + sum(pref, n - l, n - 1);
  score1 /= (long double)(2 * l + 1);
  return score1;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  long long n;
  cin >> n;
  vector<long long> inp(n);
  for (long long i = 0; i < (long long)(n); i++) {
    cin >> inp[i];
  }
  sort((inp).begin(), (inp).end());
  if (n <= 2) {
    cout << 1 << "\n";
    cout << inp[0] << "\n";
    return 0;
  }
  vector<long long> pref(n + 1);
  for (long long i = (long long)(1); i <= (long long)(n); i++) {
    pref[i] = pref[i - 1] + inp[i - 1];
  }
  pair<long double, pair<long long, long long> > res = {-1, {-1, -1}};
  for (long long i = (long long)(1); i <= (long long)(n - 2); i++) {
    long long l = 0;
    long long r = min(i, n - i - 1);
    while (l + 2 < r) {
      long long len1 = (2 * l + r) / 3;
      long long len2 = (l + 2 * r) / 3;
      if (f(pref, inp, i, len1) < f(pref, inp, i, len2)) {
        l = len1;
      } else {
        r = len2;
      }
    }
    for (long long j = (long long)(l); j <= (long long)(r); j++) {
      long double score = f(pref, inp, i, j) - inp[i];
      maxi(res, {score, {i, j}});
    }
  }
  vector<long long> vres;
  long long idx = res.second.first;
  vres.push_back(inp[idx]);
  for (long long i = 0; i < (long long)(res.second.second); i++) {
    vres.push_back(inp[idx - i - 1]);
    vres.push_back(inp[n - i - 1]);
  }
  cout << ((long long)(vres).size()) << "\n";
  for (long long a : vres) {
    cout << a << " ";
  }
  cout << "\n";
}
