#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define sz(v) (v).size()
#define all(v) (v).begin(),(v).end()
#define REP(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define Time (double)clock()/CLOCKS_PER_SEC
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int,int> pi;
template <class T> void chmax(T &x,T y) {x=x>y?x:y;return;}
template <class T> void chmin(T &x,T y) {x=x<y?x:y;return;}
template <class T> T sqr(T x) {return x*x;}
template <class T> T gcd(T x,T y) {return y==0?x:gcd(y,x%y);}
template <class T> T lcm(T x,T y) {return x/gcd(x,y)*y;}
const int inf=1000000000,mod=1000000007;
const ll infll=1000000000000000000ll,modll=ll(mod);
const db maxdb=db(infll),eps=1e-14,PI=acos(-1.0);
//#define mydef
//#define LOCAL
#ifdef mydef
#define foreach(v,it) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#endif
#define debug
#define putnum(x) cout<<#x<<": "<<x<<endl
#define putvec(v) cout<<#v<<": ";REP(i,0,sz(v)) cout<<v[i]<<" ";cout<<endl
template <class T> inline void read(T &x){
	T w=1;x=0;char c=getchar();
	while(c<'0'||c>'9') {if(c=='-')w=-1;c=getchar();}
	while(c>='0'&&c<='9') {x=(x<<3)+(x<<1)+(c&15);c=getchar();}
	x*=w;
}
template <class T> inline void write(T x) {
	if(x<0) putchar('-'),x=~x+1;
	if(x) write(x/10),putchar(x%10+'0');
}

const int maxn=300005;
int n;
int a[maxn];

class BIT {
	public:
	ll num[300005];
	BIT () {
		memset(num,0,sizeof(num));
	}
	int lowbit(int x) {
		return x&-x;
	}
	void add(int pos,int x) {
		for(int i=pos;i;i-=lowbit(i))
			num[i]+=x;
	}
	ll query(int pos) {
		ll ret=0;
		for(int i=pos;i<=n;i+=lowbit(i))
			ret+=num[i];
		return ret;
	}
};

BIT tree;
ll sum;
ll p[300005];

int main() {
	#ifdef LOCAL
		freopen("input.in","r",stdin);
		freopen("output.out","w",stdout);
	#endif
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i],a[i]++;
	for(int i=1;i<=n;i++) {
		p[a[i]]=tree.query(a[i]);
		sum+=p[a[i]];
		tree.add(a[i],1);
	}
	for(int k=0;k<n;k++) {
		//notice long long
		cout<<sum<<endl;
		ll ch=tree.query(a[k+1]);//the number that >=a[i]
		ll c1=n-ch,c2=ch-1;
		sum-=c1,sum+=c2;
	}
	return 0;
}

/*
        @uthor: Kashish Gilhotra
        user: CodeChef, CodeForces, HackerEarth, HackerRank, SPOJ: kashish001
*/

#include <bits/stdc++.h>
using namespace std;
  
#define int long long int 
typedef vector<int> vi;
typedef vector<pair<int, int>> vpi;
typedef vector<vi> vvi;
const int mod = 1e9 + 7; 

#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define debug(...) cerr << "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] " 
#define EB emplace_back
#define ALL(v) v.begin(), v.end() 
#define size(v) (int)v.size() 
#define endl '\n'
#define UMO unordered_map
#define USO unordered_set
#define TC int t; cin >> t; while (t--) 

void Panda() {
    int n;
    cin >> n;
    int m = 0, maxx = INT64_MIN;
    double euc = 0;
    for(int i = 0, x;i < n ; i++) {
        cin >> x;
        m += abs(x);
        euc += (int)pow(abs(x), 2);
        maxx = max(maxx, abs(x));
    }
    cout << m << endl;
    cout << fixed << setprecision(15) << sqrt(euc) << endl;
    cout << maxx << endl;
}
  
int32_t main() {
 
    FAST;

    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout); 
    
    Panda();

    return 0; 
} 