#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
 
const double TL = 1.5 * CLOCKS_PER_SEC;
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define clr(x, y) memset(x, y, sizeof(x))
#define forn(i, n) for (int i = 0; i < n; i++)
#define LL long long
const double pi = acos(-1.0);


int n;
int a[200005];

int main() {
#ifdef LOCAL
  auto start_clock = clock();
  freopen("in", "r", stdin);
#endif
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  bool flag = true;
  vector<int> ans;
  for (int i = 1; i <= n;) {
    if (a[i] == i) {
      i += 1;
      continue;
    }
    int j = i + 1;
    for (; j <= n && a[j] != i; j++);
    int k = j;
    while (j > i) {
      j -= 1;
      swap(a[j], a[j + 1]);
      ans.push_back(j);
    }
    for (int l = i + 1; l < k; l++) {
      if (a[l] != l) {
        flag = false;
        break;
      }
    }
    if (!flag) {
      break;
    }
  }

  if (flag && (int)ans.size() == (n - 1)) {
    for (auto w : ans) {
      printf("%d\n", w);
    }
  } else {
    puts("-1");
  }
  

#ifdef LOCAL
 auto end_clock = clock();
 cout << "Time:" << (end_clock - start_clock) * 1.0 / CLOCKS_PER_SEC << endl;
#endif
  return 0;
}
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)

typedef long long ll;
const ll INF = (1LL << 62) - (1LL << 31); /*オーバーフローしない程度に大きい数*/
const ll MOD = 1000000007;
using namespace std;

int main() {
#ifdef LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int n;
    cin >> n;
    vector<int> p(n + 1);
    vector<int> order(n + 1);
    vector<int> used(n + 1, false);
    vector<int> c_used(n + 1, false);  // 1〰nまで空いているのか？.

    typedef pair<int, int> pattern;
    vector<int> ans1;

    repi(i, 1, n + 1) {
        cin >> p[i];
        order[p[i]] = i;
    }

    bool is_ok = true;
    repi(i, 1, n + 1) {
        if (!is_ok) break;
        for (int pos = order[i]; pos != i; pos--) {
            if (pos == i) break;
            if (used[pos - 1]) {
                is_ok = false;
                break;
            } else {
                used[pos - 1] = true;
                int tmp = p[pos - 1];  // 1つ前のp[]
                p[pos - 1] = i;
                p[pos] = tmp;
                int tmp_order = order[tmp];
                order[tmp] = pos;
                order[i] = pos - 1;
                ans1.push_back(pos - 1);
            }
        }
    }

    if (is_ok && (ans1.size()==(n-1))) {
        rep(i, ans1.size()) cout << ans1[i] << endl;
    } else {
        cout << -1;
    }

    return 0;
}
