#include <bits/stdc++.h>
using namespace std;
const uint64_t seed = std::chrono::system_clock::now().time_since_epoch().count();
mt19937_64 rnd(seed);
const int MOD = 998244353;

#ifdef VIPJML_LOCAL
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << "{";
    for (typename vector<T>::const_iterator vi = v.begin(); vi != v.end(); ++vi)
    {
        if (vi != v.begin())
            os << ", ";
        os << *vi;
    }
    os << "}";
    return os;
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const vector<pair<A, B>> &v)
{
    os << "{";
    for (typename vector<pair<A, B>>::const_iterator vi = v.begin(); vi != v.end(); ++vi)
    {
        if (vi != v.begin())
            os << ", ";
        os << '(' << vi->first << " " << vi->second << ")";
    }
    os << "}";
    return os;
}

template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T)
{
    cerr << ' ' << H;
    dbg_out(T...);
}
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif
using LL = long long;

void solve(int caseNum)
{
    int N;
    cin >> N;
    vector<int> P(N);
    vector<int> idx(N);
    for (int i = 0; i < N; i++)
    {
        cin >> P[i];
        P[i]--;
        idx[P[i]] = i;
    }
    vector<int> res;
    bool f = true;
    int cur = 0;
    while (cur + 1 < N && f)
    {
        if (idx[cur] == cur)
        {
            f = false;
            break;
        }
        else
        {
            int ncur = idx[cur];
            for (int j = ncur - 1; j >= cur; j--)
            {
                swap(idx[P[j]], idx[P[j + 1]]);
                swap(P[j], P[j + 1]);
                res.push_back(j);
            }
            for (int j = cur; j < ncur; j++)
            {
                if (j != P[j])
                {
                    f = false;
                    break;
                }
            }
            cur = ncur;
        }
    }
    if (f)
    {
        for (int i = 0; i < N - 1; i++)
            cout << res[i] + 1 << "\n";
    }
    else
        cout << -1 << endl;
}

int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);
    int T = 1;
    // cin >> T;
    for (int i = 1; i <= T; i++)
    {
        solve(i);
    }
    cout.flush();
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

template<typename T> struct BIT {
    int mxn;
    vector<T> data;
    const bool zi;
    const T un;
    BIT<T>(int max_n, bool zero_indexed = false, T unit = T(0)) : mxn(max_n), zi(zero_indexed), un(unit) {
        if ( zi ) mxn++;
        data.assign(mxn + 1, unit);
    }
    void add(int i, T x) {
        if ( zi ) i++;
        assert( i > 0 );
        while ( i <= mxn ) {
            data[i] += x;
            i += i & -i;
        }
    }
    T sum(int i) {
        if ( zi ) i++;
        assert( i > 0 );
        T s = un;
        while ( i > 0 ) {
            s += data[i];
            i -= i & -i;
        }
        return s;
    }
    vector<T> get_sum_list(int l, int r) {
        vector<T> a;
        for ( int i = l; i <= r; i++ ) {
            a.push_back(sum(i));
        }
        return a;
    }
};

ll inversion(vector<ll>& v, ll v_max = -1) {
    if ( v_max < 0 ) {
        v_max = *max_element(v.begin(), v.end());
    }
    int nv = v.size();
    BIT<ll> b(v_max, true);
    ll ans = 0;
    for ( int i = 0; i < nv; i++ ) {
        ans += (ll)(i - b.sum(v[i]));
        b.add(v[i], 1);
    }
    return ans;
}


ll solve() {
    ll N;
    cin >> N;
    vector<ll> P(N);
    for ( int i = 0; i < N; i++ ) cin >> P[i];
    ll v = inversion(P, N);
    if ( v != N-1 ) return -1;
    queue<int> q;
    for ( int i = 0; i < N-1; i++ ) {
        if ( P[i] > P[i+1] ) q.push(i);
    }
    vector<int> ans;
    while ( !q.empty() ) {
        int i = q.front();
        q.pop();
        if ( P[i] > P[i+1] ) {
            ans.push_back(i);
            swap(P[i],P[i+1]);
        }
        if ( i > 0 ) {
            if ( P[i-1] > P[i] ) q.push(i-1);
        }
        if ( i+2 < N ) {
            if ( P[i+1] > P[i+2] ) q.push(i+1);
        }
    }
    for ( int i = 0; i < ans.size(); i++ ) {
        cout << ans[i]+1 << "\n";
    }
    return 0;
}

int main() {
    auto ans = solve();
    if ( ans < 0 ) {
        cout << ans << "\n";
    }
    return 0;
}