#include <bits/stdc++.h>
using namespace std;
template <class T>
T inline sqr(T x) {
  return x * x;
}
const long double pi = 3.1415926535897932384626433832795;
const long double eps = 1e-8;
bool le(pair<long long, long long> a, pair<long long, long long> b) {
  return a.first * b.second < a.second * b.first;
}
const int N = 200500;
long long a[N];
long long pref[N];
int n;
long long sum(int l, int r) {
  long long res = 0;
  if (r) res += pref[r - 1];
  if (l) res -= pref[l - 1];
  return res;
}
void pr(pair<long long, long long> a) {
  cerr << a.first << " " << a.second << endl;
}
pair<long long, long long> solve() {
  sort(a, a + n);
  pref[0] = a[0];
  for (int i = 1; i <= (int)(n - 1); ++i) pref[i] = pref[i - 1] + a[i];
  pair<long long, long long> best1(-1, 1);
  int med1, l1;
  for (int med = 0; med < n; med++) {
    int l = 0, r = min(med, n - med - 1) + 1;
    while (l + 1 < r) {
      int m = (l + r) / 2;
      pair<long long, long long> cur(
          sum(med - m, med) + sum(n - m, n) + a[med] - a[med] * (m + m + 1),
          m + m + 1);
      m--;
      pair<long long, long long> prev(
          sum(med - m, med) + sum(n - m, n) + a[med] - a[med] * (m + m + 1),
          m + m + 1);
      m++;
      if (le(prev, cur))
        l = m;
      else
        r = m;
    }
    pair<long long, long long> cur(
        sum(med - l, med) + sum(n - l, n) + a[med] - a[med] * (l + l + 1),
        l + l + 1);
    if (le(best1, cur)) {
      best1 = cur;
      med1 = med;
      l1 = l;
    }
  }
  cout << l1 + l1 + 1 << "\n";
  for (int i = med1 - l1; i <= med1; i++) cout << a[i] << " ";
  for (int i = n - l1; i < n; i++) cout << a[i] << " ";
  return best1;
}
void test(int x) {
  n = x;
  for (int tt = 0; tt < (int)(1000000); ++tt) {
    for (int i = 0; i < (int)(n); ++i) a[i] = rand() % 10;
    pair<long long, long long> best(-1, 1);
    for (int msk = 1; msk <= (int)((1 << n) - 1); ++msk) {
      pair<long long, long long> cur;
      vector<int> c;
      for (int i = 0; i < (int)(n); ++i)
        if (msk & (1 << i)) {
          c.push_back(a[i]);
        }
      sort((c).begin(), (c).end());
      if (c.size() % 2 == 1) {
        cur.second = c.size();
        cur.first =
            accumulate((c).begin(), (c).end(), 0) - c.size() * c[c.size() / 2];
      } else {
        cur.second = c.size();
        cur.first = accumulate((c).begin(), (c).end(), 0) -
                    c.size() / 2 * (c[c.size() / 2] + c[c.size() / 2 - 1]);
      }
      if (le(best, cur)) best = cur;
    }
    pair<long long, long long> x = solve();
    if (le(x, best) || le(best, x)) {
      pr(x);
      pr(best);
      for (int i = 0; i < (int)(n); ++i) cerr << a[i] << " ";
      assert(false);
    }
  }
  exit(0);
}
int main() {
  cout.precision(10);
  cout << fixed;
  srand(time(NULL));
  ios::sync_with_stdio(false);
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); ++i) {
    int x;
    scanf("%d", &x);
    a[i] = x;
  }
  solve();
  return 0;
}
