#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
}

const int maxn = 1e6 + 7;
int n;
int a[maxn];
int s = 0;
int p[maxn];
vector <int> an;
int ans = 1e9 + 6967;
void check()
{
    int sum = 0;
    for(int i = 0;i <= n - 1;i++)
    {
        if(p[i] == 1)sum += a[i];
    }
    vector <int> bn;
    if(n % 2 == 1 && sum >= s / 2 && sum < ans || n % 2 == 0 && sum >= s / 2 && sum < ans)
    {
        ans = sum;
        for(int i = 0;i <= n - 1;i++)
        {
            if(p[i] == 1)
            {
                bn.push_back(i);
            }
        }
        for(int i = 0;i <= n - 1;i++)
        {
            if(p[i] == 0)
            {
                bn.push_back(i);
            }
        }
        an = bn;
    }
}
void rec(int pos)
{
    for(int i = 0;i <= 1;i++)
    {
        p[pos] = i;
        if(pos == n - 1)check();
        else rec(pos + 1);
    }
}
std::vector<int> solve(std::vector<int> A)
{
    n = A.size();
    s = 0;
    an.clear();
    ans = 1e9 + 6769;
    for(int i = 0;i < n;i++)
    {
        a[i] = A[i];
        s += a[i];
    }
    rec(0);
    return an;
}

int main()
{
    int _n;
    cin >> _n;
    vector <int> _mazna;
    for(int i = 1;i <= _n;i++)
    {
        int x;
        cin >> x;
        _mazna.push_back(x);
    }
    vector <int> _c = solve(_mazna);
    for(auto w:_c)
    {
        cout << w << " ";
    }
    cout << endl;
}
#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
}

const int maxn = 1e6 + 7;
int n;
int a[maxn];
int s = 0;
int p[maxn];
vector <int> an;
int ans = 1e9 + 6967;
void check()
{
    int sum = 0;
    for(int i = 0;i <= n - 1;i++)
    {
        if(p[i] == 1)sum += a[i];
    }
    vector <int> bn;
    if(n % 2 == 1 && sum >= s / 2 && sum < ans || n % 2 == 0 && sum >= s / 2 && sum < ans)
    {
        ans = sum;
        for(int i = 0;i <= n - 1;i++)
        {
            if(p[i] == 1)
            {
                bn.push_back(i);
            }
        }
        for(int i = 0;i <= n - 1;i++)
        {
            if(p[i] == 0)
            {
                bn.push_back(i);
            }
        }
        an = bn;
    }
}
void rec(int pos)
{
    for(int i = 0;i <= 1;i++)
    {
        p[pos] = i;
        if(pos == n - 1)check();
        else rec(pos + 1);
    }
}
std::vector<int> solve(std::vector<int> A)
{
    n = A.size();
    s = 0;
    an.clear();
    ans = 1e9 + 6769;
    for(int i = 0;i < n;i++)
    {
        a[i] = A[i];
        s += a[i];
    }
    rec(0);
    return an;
}

int main()
{
    int _n;
    cin >> _n;
    vector <int> _mazna;
    for(int i = 1;i <= _n;i++)
    {
        int x;
        cin >> x;
        _mazna.push_back(x);
    }
    vector <int> _c = solve(_mazna);
    for(auto w:_c)
    {
        cout << w << " ";
    }
    cout << endl;
}
