#include<bits/stdc++.h>
using namespace std;
const int N = 2e5+4;
int vis[N];
int a[N],pos[N],ans[N],cnt;

int main(){
    int n;scanf("%d",&n);
    for(int i=1;i<=n;++i) scanf("%d",&a[i]),pos[a[i]]=i;
    for(int i=1;i<=n;++i){
        for(int j=pos[i];j>i;--j){
            if(vis[j-1]) {puts("-1");return 0;}
            vis[j-1]=1;
            ans[++cnt]=j-1;
            swap(a[j],a[j-1]);
            pos[a[j]]=j;
            pos[a[j-1]]=j-1;
        }
    }
    for(int i=1;i<n;++i){
        if(vis[i]!=1) {puts("-1");return 0;}
    }
    for(int i=1;i<=cnt;++i) cout<<ans[i]<<endl;
}
#include<bits/stdc++.h>

using namespace std;

/**templates**/
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;

#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define sull(x) scanf("%llu",&x)
#define sf(x) scanf("%lf",&x)
#define ss(x) scanf(" %s",x)
#define sc(x) scanf(" %c",&x)
#define pi acos(-1.0)
#define pb push_back
#define aa first
#define bb second
#define sz(x) (ll)(x).size()
#define cas printf("Case %lld: ",++t)
#define casline printf("Case %lld:\n",++t)
//#define cas cout<<"Case "<<++t<<": "
//#define casline cout<<"Case "<<++t<<":"<<endl;
#define distance(x1,y1,x2,y2)((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
#define endl "\n"
#define bug cout<<"bugggggggggggg "<<endl;
#define fast ios_base::sync_with_stdio(0);cin.tie(nullptr); ///no printf/scanf
#define clean fflush(stdout)

const ll mod = 1000000007;
const ll inf = 1LL<<62;
const ll mx = 100005;
const double eps = 1e-10;

ll dx[10]={1,0,-1,0};
ll dy[10]={0,-1,0,1};
///ll dx[] = {1,-1,0,0,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1,1,-1}; /// 8 Direction
///ll dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; /// Knight Direction

ll power(ll a,ll b)
{
    if(b==0)return 1;
    ll x=power(a,b/2);
    x=x*x;
    if(b%2)x=x*a;
    return x;
}

ll bigmod(ll a,ll b)
{
    if(b==0)return 1;
    ll x=bigmod(a,b/2)%mod;
    x=(x*x)%mod;
    if(b%2)x=(x*a)%mod;
    return x;
}

ll Set(ll N,ll pos){return N=N | (1LL<<pos);}
ll reset(ll N,ll pos){return N= N & ~(1LL<<pos);}
bool check(ll N,ll pos){return (bool)(N & (1LL<<pos));}

/**
        ...ENDING OF TEMPLATE...
*/

ll arr[2*mx],brr[2*mx];
ll ck[2*mx];

int main()
{
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);
//    fast; ///no printf/scanf
    /** Use "long double"(%Lf) instead of double for precision safety*/
    ll tst,a,b,c,k,n,m,res=0,ans=0,t=0;
    sl(n);
    for(ll i=1;i<=n;i++)
    {
        sl(arr[i]);
        brr[arr[i]]=i;
    }
    vl v;
    res=1;
    for(ll i=1;i<=n;i++)
    {
        while(brr[i]!=i)
        {
//            cout<<brr[i]<<endl;
            a=brr[i]-1;
            if(ck[a])
            {
                res=0;
                break;
            }
//            b=arr[]
            v.pb(a);
            ck[a]=1;
            swap(arr[a],arr[a+1]);
            brr[arr[a+1]]=a+1;
            brr[arr[a]]=a;
            if(sz(v)>n-1)
            {
                res=0;
                break;
            }
        }
        if(res==0)
            break;
//        for(ll i=1;i<=n;i++)
//        {
//            cout<<arr[i]<<" ";
//        }
//        cout<<endl;
    }

//    cout<<"size "<<sz(v)<<endl;
    if(sz(v)!=n-1)
    {
        cout<<-1<<endl;
        return 0;
    }

    for(ll i=1;i<=n;i++)
    {
        if(arr[i]!=i)
        {
            res=0;
            break;
        }
    }

    if(res==0)
    {
        cout<<-1<<endl;
        return 0;
    }

    for(auto i:v)
    {
        cout<<i<<endl;
    }



    return 0;
}
