#include<bits/stdc++.h>
using namespace std;

#define asll unsigned long long
#define ll long long
#define ld long double
#define imt int
#define pii pair<int,int>
#define st first
#define nd second
#define psbk(x) push_back(x);
#define For(x,a,b) for(int x=(a);x!=(b+((b-a)/abs(b-a)));x+=(b-a)/abs(b-a))
#define FOR(x,n) for(int x=0;x<(n);x++)
#define m_p make_pair

#define kj <<" "<<
#define kjb <<" ";
#define dg <<","<<
#define ml <<endl;
#define co cout<<
#define ter cout<<endl;
#define sibi cout<<"TES"<<endl;
#define tes(x) cout<<"TES"<<x<<endl;
#define kpr(x) cout<<"("<<x.st dg x.nd <<")" ml
#define kkor(p) cout<<"("<<p.x dg p.y <<")" ml
#define kera(x,m) for( int i = 0;i < m ; i++ ){ cout<<"x["<< i <<"] =" kj x[i] ml}

asll M=1e9+7;
int n,m,k,tc;
int p,q,r;
int js,js1,js2,js3,js4,js5;
int lj1,lj2;
int la,la1,la2;
string s;
stack<char> st;
string cek="   ";

int main()
{
	cin>>p;
	cin.ignore();
	getline(cin,s);
	FOR(i,s.size()){
		st.push(s[i]);
		if(st.size()>=3){
			FOR(j,3){
				cek[j]=st.top();
				st.pop();
			}
			if(cek!="xof"){
				For(j,2,0){
					st.push(cek[j]);
				}
			}
		}
	}
	co st.size() ml

}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

template<typename T> class segtree {
private:
    int n,sz,h;
    vector<T> node, lazy;
    void eval(int k) {
        if(lazy[k]){
            node[k] += lazy[k];
            if(k < n) {
                lazy[k*2] += lazy[k] / 2, lazy[k*2+1] += lazy[k] / 2;
            }
            lazy[k] = 0;
        }
    }

public:
    segtree(const vector<T>& v) : n(1), sz((int)v.size()), h(0) {
        while(n < sz) n *= 2, h++;
        node.resize(2*n, 0), lazy.resize(2*n, 0);
        for(int i = 0; i < sz; i++) node[i+n] = v[i];
        for(int i = n-1; i >= 1; i--) node[i] = node[2*i] + node[2*i+1];
    }
    void range(int a, int b, T x, int k=1, int l=0, int r=-1){
        if(r < 0) r = n;
        eval(k);
        if(b <= l || r <= a){
            return;
        }
        if(a <= l && r <= b){
            lazy[k] += (r-l)*x;
            eval(k);
        }else{
            range(a, b, x, 2*k, l, (l+r)/2);
            range(a, b, x, 2*k+1, (l+r)/2, r);
            node[k] = node[2*k] + node[2*k+1];
        }
    }
    T query(int a, int b) {
        a += n, b += n - 1;
        for(int i = h; i > 0; i--) eval(a >> i), eval(b >> i);
        b++;
        T res1 = 0, res2 = 0;
        while(a < b) {
            if(a & 1) eval(a), res1 += node[a++];
            if(b & 1) eval(--b), res2 += node[b];
            a >>= 1, b >>= 1;
        }
        return res1 + res2;
    }
    void _print(){for(int i = 0; i < sz; i++) cout<<query(i,i+1)<< " ";cout<<endl;}
};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    ll n; cin >> n;
    ll a[n]; zep(i, 0, n)cin >> a[i];
    
    vector<ll> v(n, 0);
    segtree<ll> s(v);

    ll ans = 0;
    ll cnt[n]; memset(cnt, 0, sizeof(cnt));
    zep(i, 0, n){
        ans += s.query(a[i], n);
        cnt[a[i]] = a[i] - s.query(0, a[i]);
        s.range(a[i], a[i] + 1, 1);
    }
    //printa(cnt, 0, n - 1)
    vector<ll> u(n, 0);
    segtree<ll> t(u);

    print(ans)
    zep(i, 0, n - 1){
        ans += n - i - 1 - 2 * cnt[a[i]];
        //print(ans)
        ans += t.query(a[i], n) - t.query(0, a[i]);
        print(ans)
        t.range(a[i], a[i] + 1, 1);
    }

    return 0;
}