#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 2e5 + 5;
int n;
int a[MAXN], p[MAXN];
long long ans1, ans2;
class BIT {
 private:
  long long c[MAXN];
  int lowbit(int x) { return x & -x; }

 public:
  void Add(int x, long long val) {
    while (x <= n) {
      c[x] += val;
      x += lowbit(x);
    }
  }
  long long Query(int x) {
    long long res = 0;
    while (x >= 1) {
      res += c[x];
      x -= lowbit(x);
    }
    return res;
  }
  int FindKth(int x) {
    int res = 0;
    for (int i = 20; i >= 0; i--) {
      if ((res | (1 << i)) <= n) {
        if (c[res | (1 << i)] <= x) {
          res |= (1 << i);
          x -= c[res];
        }
      }
    }
    return res;
  }
} A, B;
long long GetSum(int x) { return 1ll * x * (x + 1) / 2; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    p[a[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    A.Add(p[i], 1);
    B.Add(p[i], p[i]);
    ans1 += i - (A.Query(p[i]));
    int pos = A.FindKth(i / 2) + 1;
    int numL = A.Query(pos - 1);
    int numR = i - numL - 1;
    ans2 = 1ll * numL * pos - (long long)B.Query(pos - 1) - GetSum(numL) +
           (long long)(B.Query(n) - B.Query(pos)) - 1ll * numR * pos -
           GetSum(numR);
    printf("%lld ", ans1 + ans2);
  }
  return 0;
}
