#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
struct frac {
  long long a, b;
};
bool operator<(const frac &a, const frac &b) {
  if (fabs((double)a.b * b.a - (double)a.a * b.b) >= 1e17) {
    return (double)a.a * b.b < (double)a.b * b.a;
  } else
    return a.a * b.b - a.b * b.a < 0;
}
const int N = 1010000;
int n, x[N];
frac ans;
long long s[N];
pair<int, int> ansp;
vector<int> ret;
void gao(int l, int r, int tl, int tr) {
  int md = (l + r) >> 1;
  frac c = (frac){-1, 1};
  int pj = -1;
  for (int j = tl; j < tr + 1; j++)
    if (md >= j && n - (md - j) >= md) {
      frac r =
          (frac){s[n] - s[n - (md - j)] + s[md] - s[j - 1], 2 * (md - j) + 1};
      if (c < r) c = r, pj = j;
    }
  c.a -= x[md] * c.b;
  if (ans < c) ans = c, ansp = make_pair(pj, md);
  if (pj == -1) return;
  if (l < md) gao(l, md - 1, tl, pj);
  if (md < r) gao(md + 1, r, pj, tr);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n + 1; i++) scanf("%d", x + i);
  sort(x + 1, x + n + 1);
  for (int i = 1; i < n + 1; i++) s[i] = s[i - 1] + x[i];
  ans = (frac){-1, 1};
  gao(1, n, 1, n);
  for (int i = ansp.first; i < ansp.second + 1; i++) ret.push_back(x[i]);
  for (int i = n - (ansp.second - ansp.first) + 1; i < n + 1; i++)
    ret.push_back(x[i]);
  printf("%d\n", ((int)(ret).size()));
  for (auto x : ret) printf("%d ", x);
  puts("");
}
