#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int maxn = 2e5 + 9;
const int inf = 0x3f3f3f3f;
long long rd() {
  long long ans = 0;
  char last = ' ', ch = getchar();
  while (!(ch >= '0' && ch <= '9')) last = ch, ch = getchar();
  while (ch >= '0' && ch <= '9') ans = ans * 10 + ch - '0', ch = getchar();
  if (last == '-') ans = -ans;
  return ans;
}
int n;
int a[maxn];
int pos[maxn];
long long tr[maxn];
void update(int pos, long long val) {
  while (pos <= n) {
    tr[pos] += val;
    pos += pos & -pos;
  }
}
long long query(int pos) {
  long long res = 0;
  while (pos) {
    res += tr[pos];
    pos -= pos & -pos;
  }
  return res;
}
long long v1[maxn];
long long v2[maxn];
int main() {
  n = rd();
  for (int i = (int)(1); i <= (int)(n); i++) {
    a[i] = rd();
    pos[a[i]] = i;
  }
  for (int i = (int)(1); i <= (int)(n); i++) {
    int p = pos[i];
    v1[i] = v1[i - 1] + query(n) - query(p);
    update(p, 1);
  }
  memset(tr, 0, sizeof(tr));
  set<long long> S;
  long long center;
  for (int i = (int)(1); i <= (int)(n); i++) {
    S.insert(pos[i]);
    update(pos[i], pos[i]);
    if (i == 1) {
      center = pos[1];
    } else {
      if (i & 1) {
        if (pos[i] > center) {
          auto it = S.find(center);
          center = *(++it);
        }
      } else {
        if (pos[i] < center) {
          auto it = S.find(center);
          center = *(--it);
        }
      }
    }
    if (i & 1) {
      long long L = (center - i / 2 + center) * (i / 2 + 1) / 2 - query(center);
      long long R = query(n) - query(center) -
                    (center + 1 + center + i / 2) * (i / 2) / 2;
      v2[i] = L + R;
    } else {
      long long L = (center - i / 2 + 1 + center) * (i / 2) / 2 - query(center);
      long long R = query(n) - query(center) -
                    (center + 1 + center + i / 2) * (i / 2) / 2;
      v2[i] = L + R;
    }
  }
  for (int i = (int)(1); i <= (int)(n); i++) {
    printf("%lld%c", v1[i] + v2[i], " \n"[i == n]);
  }
  return 0;
}
