///In the name of GOD
#include<bits/stdc++.h>
#define kill() return cout << -1, 0;
using namespace std;

typedef long long ll;
const ll MXN = 2e5 + 10;
ll n;
ll A[MXN];
vector<ll> ANS, vec;
int main(){
    ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i ++) cin >> A[i];
    for(int i = 1; i < n; i ++){
        if(A[i] == i) kill();
        ll exp = i, j = i;
        while(j + 1 <= n && A[j] != exp) j ++;
        if(A[j] != exp) kill();
        vec.clear();
        for(int h = j - 1; h >= i; h --) vec.push_back(h);
        for(auto X : vec){
            swap(A[X], A[X + 1]);
            ANS.push_back(X);
        }
        for(int h = i; h < j; h ++){
            if(A[h] != h) kill();
        }
        i = j - 1;
    }
    for(auto X : ANS) cout << X << '\n';
    return 0;
}
/*!
    I CHOOSE TO HAVE FAITH,
    BECAUSE WITHOUT  THAT,
    I HAVE NOTHING....
    ITS THE ONLY THING THAT'S KEEPING ME GOING.
*/
//! N.N

#include <bits/stdc++.h>
#define lli long long int
#define vec2 vector<vector<lli>>
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define FRE freopen("explicit.in","r",stdin);freopen("explicit.out","w",stdout)
#define pll pair <lli,lli>
#define vll vector <lli>
#define vpll vector <pll>
#define f first
#define s second
#define pb push_back
#define priq priority_queue
#define unm unordered_map
#define pf push_front
#define minii LLONG_MAX
#define all(x) x.begin(), x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define ld double
#define eb emplace_back
const long double pi = 3.1415926535898;
const lli mod=1e9+7;
//const lli mod=998244353;
using namespace std;
lli lcm (lli a, lli b) {return ((a*b)/__gcd(a,b));}
lli modpower (lli a,lli b)
{
    if(b==0) return 1;
    lli c=modpower(a,b/2)%mod;
    if (b%2) return (((a*c)%mod)*c)%mod;
    else return (c*c)%mod;
}
lli power (lli a,lli b)
{
    if(b==0) return 1;
    lli c=power(a,b/2);
    if (b%2) return (a*c*c);
    else return c*c;
}
bool prime (lli k)
{
    if (k==1||k==0) return 0;
    bool flag=1;
    lli a=sqrt(k);
    for (int i=2;i<=a;i++)
    {
        if (k%i==0)
        {flag=0;break;}
    }
    return flag;
}
lli sieve (int n)
{
    bool qrr[n+1];
    for (int i=0;i<=n;i++)
    qrr[i]=1;qrr[0]=0;qrr[1]=0;
    for (int i=2;i*i<=n;i++)
    {
        if (qrr[i]==1)
        {
            for (int j=2*i;j<=n;j+=i)
            {qrr[j]=0;}
        }
    }
    return 0;
}

int main()
{
    fio;
    lli n;
    cin>>n;
    lli a[n],sum=0,maxi=0;
    ld avg=0;
    for (int i=0;i<n;i++)
    {
        cin>>a[i];
        a[i]=abs(a[i]);
        sum+=a[i];
        avg+=a[i]*a[i];
        maxi=max(maxi,a[i]);
    }
    avg=sqrt(avg);
    cout<<sum<<"\n"<<fixed<<setprecision(15)<<avg<<"\n"<<maxi;
    return 0;
}