#include <bits/stdc++.h>
using namespace std;
int n, a[200002], wz[200002], c[200002];
long long ans, sum;
typedef struct {
  int num;
  long long sum;
} P;
P p[800002];
void gx(int x, int y) {
  for (; x <= n; x += (x & -x)) c[x] += y;
}
int cx(int x) {
  int ans = 0;
  for (; x >= 1; x -= (x & -x)) ans += c[x];
  return ans;
}
long long js(long long x) { return ((1 + x) * x / 2); }
void gengxin(int root, int begin, int end, int wz) {
  if (begin > wz || end < wz) return;
  if (begin == end) {
    p[root].num++;
    p[root].sum += wz;
    return;
  }
  int mid = (begin + end) / 2;
  gengxin(root * 2, begin, mid, wz);
  gengxin(root * 2 + 1, mid + 1, end, wz);
  p[root].sum = (p[root * 2].sum + p[root * 2 + 1].sum);
  p[root].num = (p[root * 2].num + p[root * 2 + 1].num);
}
int cxk(int root, int begin, int end, int k) {
  if (begin == end) return begin;
  int mid = (begin + end) / 2;
  if (p[root * 2].num >= k)
    return cxk(root * 2, begin, mid, k);
  else
    return cxk(root * 2 + 1, mid + 1, end, k - p[root * 2].num);
}
long long chaxun(int root, int begin, int end, int begin2, int end2) {
  if (begin > end2 || end < begin2) return 0;
  if (begin >= begin2 && end <= end2) return p[root].sum;
  int mid = (begin + end) / 2;
  return chaxun(root * 2, begin, mid, begin2, end2) +
         chaxun(root * 2 + 1, mid + 1, end, begin2, end2);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    wz[a[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    gengxin(1, 1, n, wz[i]);
    if (i & 1) {
      int wt = cxk(1, 1, n, (i + 1) / 2);
      ans = -1 * chaxun(1, 1, n, 1, wt - 1) + chaxun(1, 1, n, wt + 1, n) -
            2 * js((i - 1) / 2);
    } else {
      int wt = cxk(1, 1, n, i / 2);
      ans = -1 * chaxun(1, 1, n, 1, wt) + chaxun(1, 1, n, wt + 1, n) -
            js(i / 2 - 1) - js(i / 2);
    }
    sum += cx(n) - cx(wz[i]);
    gx(wz[i], 1);
    printf("%lld", ans + sum);
    if (i != n) printf(" ");
  }
  return 0;
}
