#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;
typedef long long ll; 
const int inf = INT_MAX / 2; 
const ll infl = 1LL << 60;

int main(){
    string X;
    cin >> X;
    int size = X.size();
    string ans = "";
    rep(i,0,size){
        if(X[i] == '.'){
            break;
        }else{
            ans += X[i];
        }
    }
    cout << ans << endl;
}
#include <bits/stdc++.h>
using namespace std;
long long int mod = 998244353;
typedef long long int lli;
typedef pair<lli,lli> pii;
typedef vector<int> vi;
typedef vector<lli> vlli;
typedef vector<bool> vb;
typedef unsigned long long int ulli;
long long int max(long long int a,long long int b){
  if(a>b)
    return a;
  else
    return b;
}
long long int min(long long int a,long long int b){
  if(a<b)
    return a;
  else
    return b;
}
long long int binpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a % m;
      a = a * a % m;
      b >>= 1;
    }
  return res;
}
long long binpow(long long a, long long b) {
    if (b == 0)
        return 1;
  long long res = binpow(a, b / 2);
    if (b % 2)
        return res * res * a;
    else
        return res * res;
}
/*

  DONT SUBMIT WITHOUT PROOF

*/


 
//############################ENDOFTEMPLATE############################
struct FenwickTree {
    vector<int> bit;  // binary indexed tree
    int n;

    FenwickTree(int n) {
        this->n = n;
        bit.assign(n, 0);
    }

    FenwickTree(vector<int> a) : FenwickTree(a.size()) {
        for (size_t i = 0; i < a.size(); i++)
            add(i, a[i]);
    }

    int sum(int r) {
        int ret = 0;
        for (; r >= 0; r = (r & (r + 1)) - 1)
            ret += bit[r];
        return ret;
    }

    int sum(int l, int r) {
        return sum(r) - sum(l - 1);
    }

    void add(int idx, int delta) {
        for (; idx < n; idx = idx | (idx + 1))
            bit[idx] += delta;
    }
};



void solve(){
  int n;
  cin>>n;


  vi a(n);

  for(int i = 0;i<n;i++){
    cin>>a[i];
  }

  FenwickTree ft(n);


  lli inv = 0;

  for(int i = n-1;i>=0;i--){
    inv+= (lli)ft.sum(0,a[i]);

    ft.add(a[i],1);
  }


  vlli ans(n);
  ans[0] = inv;


  for(int i = 1;i<n;i++){
    inv-=a[i-1];
    inv+=n-1-a[i-1];
    ans[i] = inv;
  }

  for(int i = 0;i<n;i++){
    cout<<ans[i]<<endl;
  }

}







 
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  
  //#ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
  //#endif


  
  int t = 1;
  //cin>>t;

  

  for(int zz = 1;zz<=t;zz++){
    //cout<<"Case #"<<zz<<":"<<" ";
    solve();
  }
}