#include <bits/stdc++.h>
using namespace std;
template <typename _T, typename _T2>
string to_string(pair<_T, _T2> x) {
  return "<" + to_string(x.first) + ", " + to_string(x.second) + ">";
}
template <typename _T>
string to_string(vector<_T> vec) {
  string s = "[ ";
  for (auto el : vec) s += to_string(el) + ", ";
  s[s.size() - 1] = ']';
  s[s.size() - 2] = ' ';
  return s;
}
string to_string(string s) { return s; }
template <typename _T>
string to_string(set<_T> vec) {
  string s = "{ ";
  for (auto el : vec) s += to_string(el) + ", ";
  s[s.size() - 1] = '}';
  s[s.size() - 2] = ' ';
  return s;
}
template <typename _T, typename _T2>
string to_string(map<_T, _T2> vec) {
  string s = "{ ";
  for (auto el : vec)
    s += "mp[" + to_string(el.first) + "]= " + to_string(el.second) + ", ";
  s[s.size() - 1] = '}';
  s[s.size() - 2] = ' ';
  return s;
}
template <typename _T>
inline void _DBG(const char *s, _T x) {
  cerr << s << " = " << to_string(x) << "\n";
}
template <typename _T, typename... args>
void _DBG(const char *s, _T x, args... a) {
  while (*s != ',') cerr << *s++;
  cerr << " = " << to_string(x) << "\n";
  _DBG(s + 1, a...);
}
mt19937 rng___(chrono::steady_clock::now().time_since_epoch().count());
const long long MOD = 1e9 + 7;
const long long LLINF = 1e18 + 7;
const int N = 1e5 + 8;
int n;
vector<long long> vec, pref;
double skewness(int i, int r) {
  double median = vec[i];
  double avg =
      (double)(pref[i + 1] - pref[i - r] + pref[n] - pref[n - r]) / (2 * r + 1);
  return avg - median;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ;
  cin >> n;
  vec.resize(n);
  pref.resize(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }
  sort((vec).begin(), (vec).end());
  for (int i = 0; i < n; i++) {
    pref[i + 1] = pref[i] + vec[i];
  }
  pair<int, int> best = {0, 0};
  double ans = -1;
  for (int i = 0; i < n; i++) {
    double median = vec[i];
    int L = 0, R = min(i, n - i - 1);
    double curans = -1;
    pair<int, int> curbest = {-1, -1};
    while (L <= R) {
      int mid = (L + R) / 2;
      double a = skewness(i, mid);
      if (mid == R) {
        if (skewness(i, mid) > curans) {
          curans = skewness(i, mid);
          curbest = {i, mid};
        }
        break;
      }
      double b = skewness(i, mid + 1);
      if (a <= b) {
        L = mid + 2;
        if (b > curans) {
          curans = b;
          curbest = {i, mid + 1};
        }
      } else {
        R = mid - 1;
        if (a > curans) {
          curans = a;
          curbest = {i, mid};
        }
      }
    };
    ;
    if (curans > ans) {
      ans = curans;
      best = curbest;
    }
  };
  ;
  cout << best.second * 2 + 1 << '\n';
  for (int i = best.first - best.second; i <= best.first; i++)
    cout << vec[i] << " ";
  for (int i = n - 1; i > n - best.second - 1; i--) cout << vec[i] << " ";
}
