#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[300005];
long long pos[300005];
long long tree1[300005];
long long tree2[300005];
long long sum1;
long long lowbit(long long x) { return x & -x; }
void ins(long long pos, long long val, long long *tree) {
  for (; pos <= n; pos += lowbit(pos)) tree[pos] += val;
}
long long query(long long pos, long long *tree) {
  long long sum = 0;
  for (; pos; pos -= lowbit(pos)) sum += tree[pos];
  return sum;
}
long long find(long long x) {
  long long cur = 0;
  for (long long i = 20; i >= 0; --i) {
    if (cur + (1 << i) <= n && tree1[cur + (1 << i)] <= x) {
      x -= tree1[cur + (1 << i)];
      cur += (1 << i);
    }
  }
  return cur;
}
int main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; ++i) scanf("%lld", a + i);
  for (long long i = 1; i <= n; ++i) pos[a[i]] = i;
  for (long long i = 1; i <= n; ++i) {
    long long cur = pos[i];
    ins(cur, 1LL, tree1);
    ins(cur, cur, tree2);
    sum1 += i - query(cur, tree1);
    long long mid = find((i + 1) / 2 - 1) + 1;
    long long lnum = (i + 1) / 2;
    long long rnum = i - lnum;
    long long lfee = mid * lnum - query(mid, tree2) - lnum * (lnum - 1) / 2;
    long long rfee = query(n, tree2) - query(mid, tree2) - (mid + 1) * rnum -
                     rnum * (rnum - 1) / 2;
    printf("%lld ", sum1 + lfee + rfee);
  }
  printf("\n");
  return 0;
}
