#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+50;
int sum[N],a[N];
ll n;
ll lowbit(int x)	{	return x&(-x);	}
void add(int pos,int val)
{
	while(pos<=n)
	{
		sum[pos]+=val;
		pos+=lowbit(pos);
	}
}

ll query(int pos)
{
	ll res=0;
	while(pos)
	{
		res+=sum[pos];
		pos-=lowbit(pos);
	}return res;
}

int main()
{
	scanf("%lld",&n);
	ll flag=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		add(a[i],1);flag+=i-query(a[i]);
	}
	vector<int>ans;
	if(flag!=n-1)
	{
		puts("-1");
	}
	else
	{
		for(int i=1;i<=n;i++)
		{
			int cnt=(i-query(a[i]));
			int j=i-1;
			for(int k=0;k<cnt;k++)
			{
				ans.push_back(j);
				j--;
			}
		}
		for(int i=0;i<(int)ans.size();i++)	printf("%d\n",ans[i]);
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back 
#define mp make_pair
#define asort(a,n) sort(a,a+n)
#define vsort(v) sort(v.begin(),v.end())
#define all(v) v.begin(),v.end()
#define run ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cerr.tie(0);
#define mod 1000000007
#define LL_MAX LLONG_MAX
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl

int main()
{
    run;
    ll n,i;
    
        cin>>n;
        
        ll a[n+1]={0},x=1,b[n],j,w;
        vector<ll>v1[n+100];
        for(i=0;i<n;i++)
        {
         cin>>a[i];
         v1[a[i]].pb(i);
         b[i]=i+1;
        }
        set<ll>s;
        vector<ll>v;
         
         for(i=0;i<n;i++)
         {
             if(a[i]!=b[i])
             {
                 //back==if(a[i]>b[i]);
                // aage if(a[i]<b[i]);
                
               w=v1[b[i]][0];
                
                x=b[i]-1;
                
                for(j=w;j>x;j--)
                {
                     v1[a[j]][0]--;
                    v1[a[j-1]][0]++;
                    swap(a[j],a[j-1]);
                    v.push_back(min(j+1,j));
                    
                    if(s.find(min(j+1,j))==s.end())
                    s.insert(min(j+1,j));
                    else
                    {
                        cout<<-1;
                        return 0;
                    }
                    
                    if(v.size()>n-1)
                    {
                        cout<<-1;
                        return 0;
                    }
                }
                
                
               
             }
         }
         
       
         
         if(v.size()!=n-1)
         {
          cout<<-1;
          return 0;
         }
         
         for(i=0;i<v.size();i++)
          cout<<v[i]<<endl;
         
       
}
 
 