#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1E9;
int N, a[200005];
long long s[200005];
struct sol {
  long long sum, med;
  int c;
  sol() {}
  sol(long long _sum, int _c, long long _med, int _c2) {
    sum = _sum;
    med = _med;
    c = _c;
    sum *= 2;
    if (_c2 == 1) {
      med *= 2;
    }
  }
  bool operator>(const sol &ano) const {
    return sum * ano.c - med * ano.c * c > ano.sum * c - ano.med * ano.c * c;
  }
};
struct frac {
  long long a;
  int b;
  frac(long long _a, int _b) {
    a = _a;
    b = _b;
  }
  bool operator<=(const frac &ano) const { return a * ano.b <= b * ano.a; }
};
sol best;
int ansi = -1, anslen, anstype;
long long getSum(int l, int r) { return s[r] - s[l - 1]; }
frac eval(int i, int len, long long iS, int ic) {
  long long S = iS + getSum(i - len, i - 1) + getSum(N - len + 1, N);
  int c = 2 * len + ic;
  return frac(S, c);
}
void solve(int i, int maxcnt, long long iS, int ic) {
  if (maxcnt <= 0) return;
  int l = 1, r = maxcnt;
  while (l <= r) {
    int m = (l + r) / 2;
    if (eval(i, m - 1, iS, ic) <= eval(i, m, iS, ic))
      l = m + 1;
    else
      r = m - 1;
  }
  int alen = r;
  if (r == 0) return;
  frac f = eval(i, alen, iS, ic);
  sol cur = sol(f.a, f.b, iS, ic);
  if (cur.sum <= cur.med * cur.c) return;
  if (ansi == -1 || cur > best) {
    best = cur;
    ansi = i;
    anstype = ic;
    anslen = alen;
  }
}
int main() {
  cin >> N;
  for (int i = (1); i < (N + 1); i++) scanf("%d", a + i);
  sort(a + 1, a + 1 + N);
  for (int i = (1); i < (N + 1); i++) s[i] = s[i - 1] + a[i];
  for (int i = (1); i < (N + 1); i++) {
    int maxcnt = min(i - 1, N - i);
    solve(i, maxcnt, a[i], 1);
    if (i < N) {
      maxcnt = min(i - 1, N - (i + 1));
      solve(i, maxcnt, a[i] + a[i + 1], 2);
    }
  }
  if (ansi == -1) {
    printf("1\n%d\n", a[1]);
    return 0;
  }
  printf("%d\n", anslen * 2 + anstype);
  for (int i = (ansi); i < (ansi + anstype); i++) printf("%d ", a[i]);
  for (int i = (1); i < (anslen + 1); i++) {
    printf("%d %d ", a[ansi - i], a[N - i + 1]);
  }
  puts("");
  return 0;
}
