/* Problem URL: https://codeforces.com/contest/626/problem/E */

#include <bits/stdc++.h>

using namespace std;

#define V vector

#define rmin(a, b) a = min(a, b)
#define rmax(a, b) a = max(a, b)

#define rep(i, lim) for (int i = 0; i < (lim); i++)
#define nrep(i, s, lim) for (int i = s; i < (lim); i++)

#define repv(i, v) for (auto &i : (v))
#define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; }
#define sortv(v) sort(v.begin(), v.end())
#define all(v) (v).begin(), (v).end()

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vvvvi = vector<vvvi>;

using ll = long long;

using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vvvvl = vector<vvvl>;

template<class v>
auto operator<<(ostream &os, const vector<v> &vec)->ostream& {
    os << vec[0];
    for (size_t i = 1; i < vec.size(); i++) {
        os << ' ' << vec[i];
    }
    os << '\n';
    return os;
}

template<class v>
auto operator>>(istream &is, vector<v> &vec)->istream& {
    for (auto &i : vec) {
        is >> i;
    }
    return is;
}

template<class v>
auto operator<<(ostream &os, const vector<vector<v>> &vec)->ostream& {
    for (auto &i : vec) {
        os << i[0];
        for (size_t j = 1; j < i.size(); j++) {
            os << ' ' << i[j];
        }
        os << '\n';
    }
    return os;
}

template<class v>
auto operator>>(istream  &is, vector<vector<v>> &vec)->istream& {
    for (auto &i : vec) {
        for (auto &j : i) {
            is >> j;
        }
    }
    return is;
}

#define double long double

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;

    vl fds(n);
    cin >> fds;
    sortv(fds);

    pair<int, int> median = {0, 0};
    double ans = 0;
    int dev = 0;

    vl pref(n + 1);
    rep(i, n) {
        pref[i + 1] = pref[i] + fds[i];
    }

    auto search = [&](int med, int devi, int i) {
        int low = 1;
        int high = devi;

        ll ans = 0;
        while (low <= high) {
            int third = (high - low) / 3;
            int mid1 = low + third;
            int mid2 = high - third;

            double ans1 = (double)(pref[i + 1] - pref[i - mid1] + pref[n] - pref[n - mid1]) / (mid1 * 2 + med) - fds[i];
            double ans2 = (double)(pref[i + 1] - pref[i - mid2] + pref[n] - pref[n - mid2]) / (mid2 * 2 + med) - fds[i];

            if (ans1 > ans2) {
                ans = mid1;
                high = mid2 - 1;
                continue;
            }

            if (ans2 > ans1) {
                ans = mid2;
                low = mid1 + 1;
                continue;
            }

            ans = mid1;
            low = mid1 + 1;
            high = mid2 - 1;
        }

        return ans;
    };
    auto search2 = [&](int med, int devi, int i) {
        int low = 1;
        int high = devi;

        ll ans = 0;
        while (low <= high) {
            int third = (high - low) / 3;
            int mid1 = low + third;
            int mid2 = high - third;

            double ans1 = (double)(pref[i + 2] - pref[i - mid1] + pref[n] - pref[n - mid1]) / (mid1 * 2 + med) - (fds[i] + fds[i + 1]) / 2.0L;
            double ans2 = (double)(pref[i + 2] - pref[i - mid2] + pref[n] - pref[n - mid2]) / (mid2 * 2 + med) - (fds[i] + fds[i + 1]) / 2.0L;

            if (ans1 > ans2) {
                ans = mid1;
                high = mid2 - 1;
                continue;
            }

            if (ans2 > ans1) {
                ans = mid2;
                low = mid1 + 1;
                continue;
            }

            ans = mid1;
            low = mid1 + 1;
            high = mid2 - 1;
        }

        return ans;
    };

    rep(i, n) {
        int devi = min(i, n - i - 1);

        int best = search(1, devi, i);
        double tmp = (double)(pref[i + 1] - pref[i - best] + pref[n] - pref[n - best]) / (best * 2 + 1) - fds[i];

        if (tmp >= ans) {
            ans = tmp;
            median = {i, i};
            dev = best;
        }
    }

    rep(i, n - 1) {
        int devi = min(i, n - i - 2);

        int best = search2(2, devi, i);
        double tmp = (double)(pref[i + 2] - pref[i - best] + pref[n] - pref[n - best]) / (best * 2 + 2) - (fds[i] + fds[i + 1]) / 2.0L;

        if (tmp >= ans) {
            ans = tmp;
            median = {i, i + 1};
            dev = best;
        }
    }

    int size = dev * 2 + (median.first != median.second) + 1;
    cout << size << '\n';

    nrep(i, median.first - dev, median.first) {
        cout << fds[i] << ' ';
    }
    cout << fds[median.first] << ' ';
    if (median.first != median.second) {
        cout << fds[median.second] << ' ';
    }

    nrep(i, n - dev, n) {
        cout << fds[i] << ' ';
    }
    cout << '\n';
}
