#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 4;
long long n, a[N], Pos[N];
struct Interval_Tree {
  long long nodeVal[4 * N], nodeMark[4 * N];
  void update(long long i, long long l, long long r, long long x, long long y,
              long long val) {
    if (l > y || x > r) return;
    if (x <= l && r <= y) {
      nodeMark[i] = 1;
      nodeVal[i] += val;
      return;
    }
    long long mid = (l + r) / 2;
    update(2 * i, l, mid, x, y, val);
    update(2 * i + 1, mid + 1, r, x, y, val);
    nodeMark[i] = nodeMark[2 * i] + nodeMark[2 * i + 1];
    nodeVal[i] = nodeVal[2 * i] + nodeVal[2 * i + 1];
  }
  long long getVal(long long i, long long l, long long r, long long x,
                   long long y) {
    if (l > y || x > r) return 0;
    if (x <= l && r <= y) return nodeVal[i];
    long long mid = (l + r) / 2;
    long long tmp1 = getVal(2 * i, l, mid, x, y),
              tmp2 = getVal(2 * i + 1, mid + 1, r, x, y);
    return tmp1 + tmp2;
  }
  long long getMark(long long i, long long l, long long r, long long x,
                    long long y) {
    if (l > y || x > r) return 0;
    if (x <= l && r <= y) return nodeMark[i];
    long long mid = (l + r) / 2;
    long long tmp1 = getMark(2 * i, l, mid, x, y),
              tmp2 = getMark(2 * i + 1, mid + 1, r, x, y);
    return tmp1 + tmp2;
  }
  long long getMiddle(long long i, long long l, long long r, long long need) {
    if (l == r) return nodeVal[i];
    long long mid = (l + r) / 2;
    if (nodeMark[2 * i] >= need) return getMiddle(2 * i, l, mid, need);
    return getMiddle(2 * i + 1, mid + 1, r, need - nodeMark[2 * i]);
  }
} IT;
long long getSum(long long l, long long r) {
  if (l > r) return 0;
  return r * (r + 1) / 2 - (l - 1) * l / 2;
}
void sol() {
  for (long long i = 1; i <= (long long)n; ++i) Pos[a[i]] = i;
  long long addVal = 0;
  for (long long i = 1; i <= (long long)n; ++i) {
    long long cc = Pos[i];
    IT.update(1, 1, n, cc, cc, cc);
    addVal += IT.getMark(1, 1, n, cc + 1, n);
    long long pos = IT.getMiddle(1, 1, n, (i + 1) / 2);
    long long markL = IT.getMark(1, 1, n, 1, pos) - 1;
    long long x = pos - markL;
    long long res =
        -IT.getVal(1, 1, n, 1, pos) + x * (markL + 1) + getSum(1, markL);
    res += -x * (i - markL - 1) + IT.getVal(1, 1, n, pos + 1, n) -
           getSum(markL + 1, i - 1);
    cout << res + addVal << ' ';
  }
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if (fopen("input.txt", "r")) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  }
  cin >> n;
  for (long long i = 1; i <= (long long)n; ++i) cin >> a[i];
  sol();
  return 0;
}
