#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int oo = 1e9 + 7;
int a[maxn], c[maxn], n;
int pos[maxn];
long long ans[maxn];
void update(int x) {
  for (int i = x; i <= n && i; i += i & (-i)) c[i]++;
}
long long query(int x) {
  long long ans = 0;
  while (x) ans = ans + 1ll * c[x], x -= x & (-x);
  return ans;
}
long long que(int x) {
  int l = 1, r = n, ans = oo;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (x > query(mid)) {
      l = mid + 1;
    } else if (x < query(mid)) {
      r = mid - 1;
    } else
      ans = min(ans, mid), r = mid - 1;
  }
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), pos[a[i]] = i;
  ans[1] = 0;
  ans[2] = abs(pos[2] - pos[1]) - 1 + (pos[2] > pos[1] ? 0 : 1);
  update(pos[1]);
  update(pos[2]);
  for (long long i = 3; i <= n; i++) {
    update(pos[i]);
    ans[i] = ans[i - 1] + i - query(pos[i]);
    long long p = que(i / 2 + 1);
    long long p1 = que(i / 2);
    long long p2 = que(i / 2 + 2);
    ans[i] = ans[i] + 1ll * (p - p1 - 1) * (i / 2) +
             1ll * (p2 - p - 1) * (i / 2 + 1);
  }
  for (int i = 1; i <= n; i++) {
    if (i != 1) printf(" ");
    printf("%lld", ans[i]);
  }
}
