#include <bits/stdc++.h>
using namespace std;
istream* pin;
uintmax_t konstansmod = (1e9) + 7;
template <typename T>
vector<T> read(int num = -1, int szorzo = 1, istream& in = *pin) {
  vector<T> container;
  if (num == -1) in >> num;
  num *= szorzo;
  for (int i = 0; i < num; i++) {
    T q;
    in >> q;
    container.push_back(q);
  }
  return container;
}
struct printer {
  ostream* o;
  printer(ostream& a = cout) : o(&a) {}
  void pr() { *o << "\n"; }
  template <typename T>
  void pr(T uintmax_t) {
    *o << std::setprecision(9) << uintmax_t << "\n";
  }
  template <typename T>
  void pr(vector<T> uintmax_t) {
    for (T w : uintmax_t) pr(w);
    pr();
  }
  template <typename T, typename... Args>
  void pr(T value, Args... args) {
    pr(value);
    pr(args...);
  }
};
template <typename H1>
void show(std::ostream& out, const char* label, H1&& value) {
  out << label << "=";
  printer(out).pr(value);
}
template <typename H1, typename... T>
void show(std::ostream& out, const char* label, H1&& value, T&&... rest) {
  const char* pcomma = strchr(label, ',');
  out.write(label, pcomma - label) << "=";
  printer(out).pr(value);
  show(out, pcomma + 1, std::forward<T>(rest)...);
}
void print(bool b) { cout << (b ? "Yes" : "No") << "\n"; }
void solve();
int main(int argc, char** argv) {
  srand((unsigned)time(NULL));
  ifstream* argfile = NULL;
  string filename = "";
  if (argc >= 2 && filename.length() == 0) filename = argv[1];
  if (filename.length() > 0) {
    argfile = new ifstream(filename);
    if (!argfile->is_open()) {
      cerr << "file cant be opened,exiting. Filename:" << filename << "\n";
      cerr << "Error: " << strerror(errno) << "\n";
      return 1;
    }
  }
  if (argfile) std::cin.rdbuf(argfile->rdbuf());
  istream& myfile = argfile ? *argfile : cin;
  pin = &myfile;
  int num;
  solve();
  return 0;
  myfile >> num;
  for (int i = 0; i < num; i++) {
    cout << "Case #" << (i + 1) << ": ";
    solve();
  }
  return 0;
}
double calc_skew(set<uintmax_t>& sol) {}
void solve() {
  int n;
  cin >> n;
  vector<uintmax_t> g = read<uintmax_t>(n);
  sort(g.begin(), g.end());
  int bestp = 0;
  double valb = 0;
  int db = 0;
  uintmax_t sums[1000001];
  for (int i = g.size() - 1; i >= 0; i--) {
    sums[i] = g[i] + sums[i + 1];
  }
  for (int i = 1; i <= n - 2; i++) {
    uintmax_t median = g[i];
    int a = 1;
    int b = min(i, n - i);
    while (a != b) {
      uintmax_t meret = (b - a) / 3;
      uintmax_t ao = a + meret;
      uintmax_t bo = ao + meret;
      if (meret == 0) {
        bo = ao + 1;
      }
      double newsuma = 0;
      newsuma += sums[i - ao] - sums[i + 1] + sums[n - ao];
      newsuma /= (double)(ao * 2 + 1);
      double newsumb = 0;
      newsumb += sums[i - bo] - sums[i + 1] + sums[n - bo];
      newsumb /= (double)(bo * 2 + 1);
      if (newsuma > newsumb) {
        if (b == bo)
          b = ao;
        else
          b = bo;
      } else {
        if (a == ao)
          a = bo;
        else
          a = ao;
      }
    }
    double newsum = 0;
    newsum += sums[i - a] - sums[i + 1] + sums[n - a];
    newsum /= (double)(a * 2 + 1);
    newsum -= median;
    double val = newsum;
    if (val > valb) {
      valb = val;
      bestp = i;
      db = a;
    }
  }
  printf("%d \n", db * 2 + 1);
  for (int i = 0; i <= db; i++) {
    printf("%d ", g[bestp - i]);
  }
  for (int i = n - db; i < n; i++) {
    printf("%d ", g[i]);
  }
}
