#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int maxn = 200005;
int a[maxn];
long long t1[maxn], t2[maxn];
void update(long long *t, int x, long long y, int n) {
  for (int i = x; i <= n; i += i & -i) t[i] += y;
}
long long getsum(long long *t, int x) {
  long long ans = 0;
  for (int i = x; i; i -= i & -i) ans += t[i];
  return ans;
}
int main() {
  int n, x;
  scanf("%d", &n);
  for (int i = 1, x; i <= n; i++) {
    scanf("%d", &x);
    a[x] = i;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    update(t1, a[i], 1, n);
    ans += i - getsum(t1, a[i]);
    update(t2, a[i], a[i], n);
    x = i / 2 + 1;
    int l = 1, r = n;
    while (l < r) {
      int mid = (l + r) >> 1;
      if (getsum(t1, mid) >= x)
        r = mid;
      else
        l = mid + 1;
    }
    long long s = getsum(t2, l);
    long long sum = 1LL * l * (l + 1) / 2 - s - 1LL * (l - x) * (l - x + 1) / 2;
    sum += getsum(t2, n) - s - (1LL * i - x) * (1LL * l + 1 + i - x + l) / 2;
    printf("%lld ", sum + ans);
  }
  return 0;
}
