#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<numeric>
#include<functional>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<bit>

using namespace std;

//#define int long long
#define pii pair<int, int>
#define ll long long
#define ull unsigned ll
#define ve vector
#define vi ve<int>
#define vvi ve<vi>
#define vll ve<ll>
#define tiii tuple<int, int, int>
#define tiiii tuple<int, int, int, int>
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a= max(a, b)
#define all(a) a.begin(), a.end()
#define for0(i, n) for(int i= 0; i < n; ++i)

extern vector<int> solve(vector<int> A) {
    int n = A.size();
    vll a; for (auto now : A) a.push_back(now);
    int bmask = 0;
    ll sm = accumulate(all(a), 0ll);
    vll sum((1ll << n), 0), mx((1ll << n), 0);
    auto get_val = [&](int mask) {
        return (2 * sum[mask] >= sm && 2 * (sum[mask] - mx[mask]) < sm ? abs(n - 2 * popcount((ull)mask)) : 1e9);
        };
    for (int mask = 1; mask < (1 << n); ++mask) {
        if ((mask & (mask - 1)) == 0) {
            sum[mask] = a[countr_zero((ull)mask)];
            mx[mask] = a[countr_zero((ull)mask)];
        }
        else {
            sum[mask] = sum[mask - (mask & -mask)] + sum[mask & -mask];
            mx[mask] = max(mx[mask - (mask & -mask)], mx[mask & -mask]);
        }
        if (get_val(mask) < get_val(bmask)) bmask = mask;
    }
    vi ans;
    cout << get_val(bmask) << "\n";
    int k = popcount((ull)bmask);
    for (int i = 0; i < n; ++i) {
        if ((bmask & (1 << i))) ans.push_back(i);
    }
    for (int i = 0; i < k; ++i) if (a[ans[i]] > a[ans.back()]) swap(ans[i], ans.back());
    for (int i = 0; i < n; ++i) {
        if (!(bmask & (1 << i))) ans.push_back(i);
    }
    return ans;
}