#include <bits/stdc++.h>
using namespace std;
long long n, p[200005], tr[200005];
vector<pair<long long, long long> > ar;
long long val(long long a) {
  long long ret = 0;
  while (a) {
    ret += tr[a];
    a -= a & -a;
  }
  return ret;
}
void upd(long long a, long long x) {
  while (a <= n) {
    tr[a] += x;
    a += a & -a;
  }
}
long long bsh(long long a) {
  long long l = 0, r = n;
  while (l + 1 < r) {
    long long md = (l + r) >> 1;
    if (val(md) >= a)
      r = md;
    else
      l = md;
  }
  return r;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long a;
    cin >> a;
    ar.push_back({a, i});
  }
  sort(ar.begin(), ar.end());
  for (int i = 0; i < n; i++) {
    long long l = (i + 1) / 2, r = (i + 1) / 2, v = 0;
    if (i % 2 == 0) r += 1;
    l = bsh(l), r = bsh(r);
    if (!(l <= ar[i].second && ar[i].second <= r)) {
      if (ar[i].second < l)
        v = l - ar[i].second - (val(l) - val(ar[i].second));
      else
        v = ar[i].second - 1 - r - (val(ar[i].second - 1) - val(r));
    }
    p[i + 1] = i - val(ar[i].second) + p[i] + v -
               min(val(ar[i].second), i - val(ar[i].second));
    upd(ar[i].second, 1);
  }
  for (int i = 1; i <= n; i++) cout << p[i] << " ";
  return 0;
}
