#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> solve(vector<int> A) {
    vector<pair<int, int>> a;
    for (int i = 0; i < (int)A.size(); i++) {
        a.push_back({ A[i], i});
    }
    sort(a.begin(), a.end());
    vector<int> ans;
    for (int i = 1; i < (int)a.size(); i += 2) {
        ans.push_back(a[i].second);
    }
    if ((int)a.size() % 2 == 1) ans.push_back(a.back().second);
    for (int i = 0; i < (int)a.size() - 1; i += 2) {
        ans.push_back(a[i].second);
    }
    return ans;
}
/*
int main() {
    vector<int> w = { 2, 2, 3, 2, 3, 2, 2, 3 };
    vector<int> q = solve(w);
    for (auto it : q) {
        cout << it << " ";
    }
    cout << "\n";
}
*/