#include <bits/stdc++.h>
int counting_sort[30000005];
using namespace std;
vector <int> ez_points(vector <int> z)
{
    int n = z.size();
    vector <int> ans;
    if(n % 2 == 0)
    {
        for(int i = 0;i < n / 2;i++)
        {
            ans.push_back(n - i - 1);
            ans.push_back(i);
        }
    }
    else
    {
        for(int i = 0;i < n / 2;i++)
        {
            ans.push_back(n - i - 1);
            ans.push_back(i);
        }
        ans.push_back(n / 2);
    }
    return ans;
}
vector <int> more_ez_points(vector <int> z)
{
    vector <pair<int , int>> v;
    for(int i = 0;i < n;i++)
    {
        v.push_back(z[i] , i);
    }
    int n = z.size();
    sort(v.begin() , v.end());
    vector <int> f;
    vector <int> s;
    for(int i = 0;i < n;i += 2)
    {
        f.push_back(v[i].second);
        s.push_back(v[i].second);
    }
    vector <int> ans;
    for(int i = 0;i < f.size();i++)
    {
        ans.push_back(f[i]);
    }
    for(int i = 0;i < s.size();i++)
    {
        ans.push_back(s[i]);
    }
    return ans;
}
vector <int> solve(vector <int> z)
{
    int n = z.size();
    for(int i = 0;i < n;i++)
    {
        if(z[i] == i + 1)continue;
        else
        {
            return more_ez_points(z);
        }
    }
    return ez_points(z);
}
/*int main()
{
    int r1;cin >> r1;
    vector <int> r;
    for(int i = 0;i < r1;i++)
    {
        int a;cin >> a;
        r.push_back(a);
    }
    vector <int> ans = solve(r);
    for(int i = 0;i < r1;i++)
    {
        cout << ans[i] << " ";
    }
    cout << endl;
}*/
