#include <cstdio>
#include <algorithm>

const int N = 2e5 + 5;

int a[N];
int b[N];
int ans[N];

int main() {
#ifndef ONLINE_JUDGE
	freopen("in", "r", stdin);
#endif
	int n;
	while (~scanf("%d", &n)) {
		for (int i = 1; i <= n; ++i) {
			scanf("%d", &a[i]);
			b[a[i]] = i;
		}
		int cnt = 0;
		for (int i = n; i >= 1; --i) {
			for (int k = b[i]; k < i; ++k) {
				std::swap(a[k], a[k + 1]);
				std::swap(b[a[k]], b[a[k + 1]]);
				ans[cnt++] = k;
				if (cnt >= n - 1) {
					break;
				}
			}
			if (cnt >= n - 1) {
				break;
			}
		}
		if (std::is_sorted(a, a +n) && cnt == n - 1) {
			for (int i = 0; i < cnt; ++i) {
				printf("%d\n", ans[i]);
			}
		} else {
			printf("-1\n");
		}
	}
	return 0;
}

/*
	author : pshishod2645
	Created at : 06:05:49 PM, 05 December 2020
*/


#include <bits/stdc++.h>

using namespace std;

const int MOD = 1e9 + 7;

typedef long long ll;
//#define int long long 
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;
// os.find_by_order(k) -> find kth element
// os.order_of_key(x) -> find number of elements strictly less than x

#define cerr cout
#define sz(a) (int)((a).size())
#define all(x) (x).begin(), (x).end()
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
inline int add(int a, int b){a += b; if(a >= MOD)a -= MOD; return a;}
inline int sub(int a, int b){a -= b; if(a < 0)a += MOD; return a;}
inline int mul(int a, int b){return (int)((long long) a * b %MOD);}
inline int binpow(int a, int b){int res = 1; while(b > 0){ if(b & 1)res = mul(res, a); a = mul(a, a);b /= 2;} return res;}
inline int inv(int a){return binpow(a, MOD - 2);}
int gcd(int a, int b, int &x, int &y){if(a == 0){x = 0, y = 1; return b;} int x1, y1;  int d = gcd(b%a, a, x1, y1); x = y1 - (b/a) * x1; y = x1; return d;}
int gcd(int x, int y){return y? gcd(y, x%y) : x; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// uniform_int_distribution<int> (l, r) (rng) 	// generates random number in [l, r] inclusive
// shuffle(beginIter, endIter, rng)	// randomly shuffles elements in range [beginIter, endIter]

const int N = 2e5 + 5; 
int n, a[N], possible = 1, pos[N]; 
vector<int> ops; 

void find(int ind){
	// pr(ind); pr(ops); 
	if(ind == 1){
		if(a[ind] != 1)possible = 0; return ; 
	}

	if(a[ind] == ind){
		possible = 0; return ; 
	}
	int prv = pos[ind]; 
	for(int i = prv; i < ind; ++i){
		ops.push_back(i);
		if(i != prv && a[i + 1] != i){
			// pr(i, a[i + 1], i); 
			possible = 0; return ; 
		}
	} 
	pos[a[prv + 1]] = prv; a[prv] = a[prv + 1]; 
	find(prv); 
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    cin>>n; 
    for(int i = 1;i <= n; ++i){
    	cin>>a[i]; pos[a[i]] = i; 
    }

    find(n); 
    if(!possible){
    	cout<<"-1\n"; return 0; 
    }
    for(int i: ops)cout<<i<<"\n"; 

    return 0;
}