#include<bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

const int inf = 1e9;

int n;

int find1(vll& pr, ll val) {
	int left = 1, right = n;
	int ans = -1;
	while (left <= right) {
		int mid = (left + right) / 2;
		if (pr[mid] >= val) {
			ans = mid;
			right = mid - 1;
		}
		else left = mid + 1;
	}
	assert(ans != -1);
	return ans;
}

int find2(vll& pr, ll val) {
	int ans = -1;
	int left = 1, right = n;
	while (left <= right) {
		int mid = (left + right) / 2;
		if (pr[n] - pr[mid - 1] >= val) {
			ans = mid;
			left = mid + 1;
		}
		else right = mid - 1;
	}
	assert(ans != -1);
	return ans;
}

vi solve(vi a) {
	n = a.size();
	
	unordered_map<int, stack<int>> inds;
	for (int i=0; i<n; i++) {
		inds[a[i]].push(i);
	}
	
	sort(all(a));
	
	ll tot = accumulate(all(a), 0LL);
	tot = (tot + 1) / 2;
	
	vll pr(n + 1);
	for (int i=1; i<=n; i++) {
		pr[i] = pr[i - 1] + a[i - 1];
	}
	
	int mn = n - find2(pr, tot) + 1;
	int mx = find1(pr, tot);
	
//	cout << mn << ' ' << mx << endl;
	
	int m = -1, diff = inf;
	int half = n / 2;
	if (half >= mn && half <= mx) m = half;
	else if (half < mn) m = mn;
	else if (half > mx) m = mx;
	assert(m != -1);
	
	ll sum = 0;
	int i;
	for (i=0; i<n; i++) {
		sum += a[i];
		if (i >= m) sum -= a[i - m];
		if (sum >= tot && i+1 >= m) break;
	}
	
	vi ans;
	for (int j=i-m+1; j<=i; j++) {
		ans.pb(inds[a[j]].top());
		inds[a[j]].pop();
	}
	
	for (int j=0; j<n; j++) {
		if (j >= i - m + 1 && j <= i) continue;
		ans.pb(inds[a[j]].top());
		inds[a[j]].pop();
	}
	
	return ans;
}

/*
int main() {
	int n;
	cin >> n;
	vi a(n);
	for (int i=0; i<n; i++) cin >> a[i];
	
	vi ans = solve(a);
	
	for (int d : ans) cout << d << ' ';
	cout << endl;
	for (int d : ans) cout << a[d] << ' ';
	
	return 0;
}

/*
9
5 6 6 3 1 1 4 4 3

8
2 2 3 2 3 2 2 3
*/