#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long MAXN = 2e5 + 7;
const long long MAXM = 1e5 + 7;
const long long MOD = 1e9 + 7;
const double eps = 1e-6;
const double pi = acos(-1.0);
long long c1[MAXN + 5], c2[MAXN + 5];
int lowbit(int x) { return x & -x; }
void add(long long *c, int x, int v) {
  for (int i = x; i <= MAXN; i += lowbit(i)) c[i] += v;
}
long long getsum(long long *c, int x) {
  long long ans = 0;
  for (int i = x; i > 0; i -= lowbit(i)) ans += c[i];
  return ans;
}
int a[MAXN];
int pos[MAXN];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), pos[a[i]] = i;
  long long rev = 0;
  for (int i = 1; i <= n; i++) {
    rev += i - getsum(c1, pos[i]) - 1;
    add(c1, pos[i], 1);
    add(c2, pos[i], pos[i]);
    int l = 1, r = n;
    int mid;
    if (i == 1) {
      printf("0 ");
      continue;
    }
    while (l < r) {
      mid = (l + r) >> 1;
      if (getsum(c1, mid) * 2 <= i)
        l = mid + 1;
      else
        r = mid;
    }
    long long ans = 0;
    long long cntL = getsum(c1, mid), cntR = i - cntL;
    long long lenL = getsum(c2, mid), lenR = getsum(c2, n) - lenL;
    ans += ((mid * 2 - cntL + 1) * cntL) / 2 - lenL;
    ans += (lenR - ((2 * mid + 1 + cntR) * cntR) / 2);
    printf("%lld ", rev + ans);
  }
  printf("\n");
  return 0;
}
