#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, vi> inds;
	for (int i=0; i<n; i++) {
		inds[a[i]].pb(i);
	}
	
	sort(all(a));
	
	ll tot = accumulate(all(a), 0LL);
	tot = (tot + 1) / 2;
	
	int m = n / 2;
	
	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]].back());
		inds[a[j]].pop_back();
	}
	
	for (int j=0; j<n; j++) {
		if (j >= i - m + 1 && j <= i) continue;
		ans.pb(inds[a[j]].back());
		inds[a[j]].pop_back();
	}
	
	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
*/