#include <bits/stdc++.h>
using namespace std;
long long bigadd(long long &a, long long &b) {
  a += b % 1000000007;
  while (a < 0) a += 1000000007;
  a %= 1000000007;
}
long long bigpow(long long a, long long b) {
  long long res = 1;
  a %= 1000000007;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
  }
  return res;
}
void main2();
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  main2();
  return 0;
}
int N;
struct Fraction {
  long long a;
  long long b;
  inline bool operator<(const Fraction &other) const {
    return a * other.b < b * other.a;
  }
  Fraction(long long _a, long long _b) : a(_a), b(_b) {}
};
vector<int> x;
vector<long long> y;
long long get(int start, int end) {
  if (start > end) return 0LL;
  if (start == 0) {
    return y[end];
  } else {
    return y[end] - y[start - 1];
  }
}
Fraction f(int len, int i) {
  int start = i - len, end = i;
  return Fraction(get(start, end) + get(N - len, N - 1), len * 2LL + 1LL);
}
void main2() {
  scanf("%d", &N);
  x = vector<int>(N);
  for (int(i) = 0; (i) < (int)(N); (i)++) scanf("%d", &x[i]);
  sort(x.begin(), x.end());
  Fraction ans = Fraction(0, 1);
  int ansi = 0, anslen = 0;
  for (auto i : x)
    if (y.empty())
      y.push_back((long long)i);
    else
      y.push_back(y.back() + (long long)i);
  for (int i = 0; i < N; i++) {
    int len = min(i, N - 1 - i);
    int l = 0, r = len;
    while (r - l > 3) {
      int nl = (l + l + r) / 3, nr = (l + r + r) / 3;
      if (f(nl, i) < f(nr, i)) {
        l = nl;
      } else {
        r = nr;
      }
    }
    for (int fl = l; fl <= r; fl++) {
      Fraction cur = f(fl, i);
      cur.a -= cur.b * (long long)x[i];
      if (ans < cur) {
        ansi = i;
        ans = cur;
        anslen = fl;
      }
    }
  }
  vector<int> ret;
  for (int i = ansi - anslen; i <= ansi; i++) ret.push_back(x[i]);
  for (int i = N - anslen; i <= N - 1; i++) ret.push_back(x[i]);
  printf("%d\n", (int)ret.size());
  for (auto i : ret) printf("%d\n", i);
}
