#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long qpow(long long a, long long b, long long m) {
  long long r = 1;
  a %= m;
  for (; b; b >>= 1) {
    if (b & 1) r = r * a % m;
    a = a * a % m;
  }
  return r;
}
const int inf = 0x7fffffff;
const int maxn = 2e5 + 10;
long long a[maxn], b[maxn];
int pos[maxn], p[maxn];
long long ans[maxn];
int n;
int lowbit(int x) { return x & -x; }
void add(int x, long long xx) {
  while (x <= n) {
    b[x] += xx;
    x += lowbit(x);
  }
}
long long qsum(int x) {
  long long res = 0;
  while (x) {
    res += b[x];
    x -= lowbit(x);
  }
  return res;
}
int lower_bound(long long x) {
  int k = 1, res = 0;
  while (k <= n) k <<= 1;
  for (; k; k >>= 1) {
    if (res + k <= n && b[res + k] <= x) {
      x -= b[res + k];
      res += k;
    }
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pos[a[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    ans[i] = ans[i - 1] + (long long)(i - 1) - qsum(pos[i]);
    add(pos[i], 1);
    p[i] = lower_bound(i / 2) + 1;
  }
  for (int i = 1; i <= n; i++) b[i] = 0;
  for (int i = 1; i <= n; i++) {
    add(pos[i], pos[i]);
    long long x = i / 2, y = i - i / 2 - 1;
    ans[i] += x * p[i] - qsum(p[i] - 1) - x * (x + 1LL) / 2LL;
    ans[i] += qsum(n) - qsum(p[i]) - y * p[i] - y * (y + 1LL) / 2LL;
  }
  for (int i = 1; i <= n; i++) {
    if (i - 1) cout << " ";
    cout << ans[i];
  }
  cout << endl;
  return 0;
}
