#include <bits/stdc++.h>
using namespace std;
void read(long long &x) {
  char ch = getchar();
  x = 0;
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
}
const long long N = 2e5 + 5;
long long n, a[N], p[N];
struct tree {
  long long c[N];
  void add(long long x, long long v) {
    for (; x <= n; x += (x & -x)) c[x] += v;
  }
  long long ask(long long x) {
    long long s = 0;
    for (; x; x -= (x & -x)) s += c[x];
    return s;
  }
  long long get(long long k) {
    long long res = 0;
    for (long long j = 17; ~j; --j)
      if ((res | 1 << j) <= n && c[res | (1 << j)] <= k)
        res |= 1 << j, k -= c[res];
    return res;
  }
} A, B;
signed main() {
  read(n);
  long long num = 0;
  for (long long i = 1; i <= n; ++i) read(a[i]), p[a[i]] = i;
  for (long long i = 1, j; i <= n; ++i) {
    A.add(p[i], 1), B.add(p[i], p[i]);
    long long res = 0;
    num += i - A.ask(p[i]), j = A.get(i / 2) + 1;
    long long n1 = i / 2, n2 = i - 1 - n1;
    res = n1 * j - B.ask(j - 1) - n1 * (n1 + 1) / 2;
    res += B.ask(n) - B.ask(j) - n2 * j - n2 * (n2 + 1) / 2;
    printf("%lld ", num + res);
  }
  return 0;
}
