#include <bits/stdc++.h>
using namespace std;
#define MAXN 100005
int N;
int A[100000];
int T[MAXN+1];
int getSum(int i)
{
int c=0;
for(++i; i > 0 ; i -= (i & -i))
c += T[i];
return c;
}
void Set(int i,int dif)
{
for(++i; i < MAXN ; i += (i & -i))
T[i] += dif;
}
long long cnt[100000];
int main()
{
freopen("daonguoc.inp","r",stdin);
freopen("daonguoc.out","w",stdout);
cin >> N;
int a;
for(int i=0;i<N;i++)
{
cin >> a;
a++;
cnt[a] += i - getSum(a);
Set(a,1);
}
long long ans = 0;
for(int j=1;j<=N;j++)
{
cout << ans << '\n';
ans += cnt[j];
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgTUFYTiAxMDAwMDUKCmludCBOOwppbnQgQVsxMDAwMDBdOwppbnQgVFtNQVhOKzFdOwoKaW50IGdldFN1bShpbnQgaSkKewoJaW50IGM9MDsKCWZvcigrK2k7IGkgPiAwIDsgaSAtPSAoaSAmIC1pKSkKCQljICs9IFRbaV07CglyZXR1cm4gYzsKfQp2b2lkIFNldChpbnQgaSxpbnQgZGlmKQp7Cglmb3IoKytpOyBpIDwgTUFYTiA7IGkgKz0gKGkgJiAtaSkpCgkJVFtpXSArPSBkaWY7Cn0KCmxvbmcgbG9uZyBjbnRbMTAwMDAwXTsKCmludCBtYWluKCkKewoJZnJlb3BlbigiZGFvbmd1b2MuaW5wIiwiciIsc3RkaW4pOwoJZnJlb3BlbigiZGFvbmd1b2Mub3V0IiwidyIsc3Rkb3V0KTsKCWNpbiA+PiBOOwoJaW50IGE7Cglmb3IoaW50IGk9MDtpPE47aSsrKQoJewoJCWNpbiA+PiBhOwoJCWErKzsKCQljbnRbYV0gKz0gaSAtIGdldFN1bShhKTsKCQlTZXQoYSwxKTsKCX0KCWxvbmcgbG9uZyBhbnMgPSAwOwoJZm9yKGludCBqPTE7ajw9TjtqKyspCgl7CgkJY291dCA8PCBhbnMgPDwgJ1xuJzsKCQlhbnMgKz0gY250W2pdOwoJfQp9Cg==