#include <bits/stdc++.h>
using namespace std;
long long n, t;
long long place[200005];
long long ans[200005], fin[200005];
struct node {
  long long num;
  long long sum;
  long long tot;
} tree[1000005];
void pushdown(long long pos) {
  tree[pos].sum = tree[pos << 1].sum + tree[pos << 1 | 1].sum;
  tree[pos].tot = tree[pos << 1].tot + tree[pos << 1 | 1].tot;
  return;
}
void update(long long pos, long long l, long long r, long long fin,
            long long num) {
  if (l == r) {
    tree[pos].num = num;
    tree[pos].sum++;
    tree[pos].tot += fin;
    return;
  }
  long long mid = (l + r) >> 1;
  if (fin <= mid) {
    update(pos << 1, l, mid, fin, num);
  } else
    update(pos << 1 | 1, mid + 1, r, fin, num);
  pushdown(pos);
}
long long query(long long pos, long long l, long long r, long long fin) {
  if (l == r) {
    return l;
  }
  long long mid = (l + r) >> 1;
  if (tree[pos << 1].sum >= fin) {
    return query(pos << 1, l, mid, fin);
  } else {
    return query(pos << 1 | 1, mid + 1, r, fin - tree[pos << 1].sum);
  }
}
long long sum(long long pos, long long l, long long r, long long fin) {
  if (fin == 0) return 0;
  if (l == r) {
    return tree[pos].tot;
  }
  long long mid = (l + r) >> 1;
  if (fin > mid) {
    return tree[pos << 1].tot + sum(pos << 1 | 1, mid + 1, r, fin);
  } else {
    return sum(pos << 1, l, mid, fin);
  }
}
long long sum2(long long pos, long long l, long long r, long long fin) {
  if (fin == 0) return 0;
  if (l == r) {
    return tree[pos].sum;
  }
  long long mid = (l + r) >> 1;
  if (fin > mid) {
    return tree[pos << 1].sum + sum2(pos << 1 | 1, mid + 1, r, fin);
  } else {
    return sum2(pos << 1, l, mid, fin);
  }
}
int main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> t;
    place[t] = i;
  }
  ans[1] = 0;
  long long tmp;
  for (long long i = 1; i <= n; i++) {
    update(1, 1, n, place[i], i);
    long long step;
    if (i % 2 == 0) {
      step = query(1, 1, n, i / 2);
      tmp = sum(1, 1, n, n) - sum(1, 1, n, step) - (i / 2) * step -
            (1 + i / 2) * (i / 2) / 2 + (i / 2 - 1) * step -
            sum(1, 1, n, step - 1) - (i / 2 - 1) * (i / 2) / 2;
    } else {
      step = query(1, 1, n, i / 2 + 1);
      tmp = sum(1, 1, n, n) - sum(1, 1, n, step) - (i / 2) * step -
            (1 + i / 2) * (i / 2) / 2 + (i / 2) * step -
            sum(1, 1, n, step - 1) - (i / 2 + 1) * (i / 2) / 2;
    }
    ans[i] = ans[i - 1] + i - sum2(1, 1, n, place[i]);
    fin[i] = ans[i] + tmp;
  }
  for (long long i = 1; i <= n; i++) {
    cout << fin[i] << ' ';
  }
  return 0;
}
