#include <bits/stdc++.h>
using namespace std;
int fb(int n) { return n <= 2 ? n : sizeof(n) * 8 - __builtin_clz(n); }
int ceil2(int n) { return 1 << fb(n - 1); }
template <class A, class B>
ostream& operator<<(ostream& os, pair<A, B> p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <class A>
ostream& operator<<(ostream& os, vector<A> v) {
  os << "{ ";
  for (auto& x : v) cout << x << " ";
  return os << "}";
}
template <class A>
ostream& operator<<(ostream& os, vector<vector<A>> v) {
  os << "{" << v.front() << '\n';
  for (auto it = next(v.begin()); it != v.end(); it++) os << " " << *it << '\n';
  return os << "}";
}
using VI = vector<int>;
using VVI = vector<VI>;
using II = pair<int, int>;
using VII = vector<II>;
using L = long long;
using VL = vector<L>;
using VB = vector<bool>;
struct Node {
  L sum;
  int number;
  Node() {
    sum = 0;
    number = 0;
  }
};
Node operator+(Node a, Node b) {
  Node c;
  c.sum = a.sum + b.sum;
  c.number = a.number + b.number;
  return c;
}
L inversions = 0;
struct Tree {
  int sz;
  vector<Node> tr;
  Tree(int n) {
    sz = ceil2(n);
    tr.resize(sz << 1, Node());
  }
  void Query(int i, int x) {
    ;
    int y = x + sz;
    tr[y].number = 1;
    tr[y].sum = x;
    while (y >>= 1) tr[y] = tr[y << 1] + tr[y << 1 | 1];
    if (x < sz - 1) {
      Node inv = sum(x + 1, sz - 1);
      inversions += inv.number;
    };
    if (i == 1) {
      cout << "0 ";
      return;
    }
    L median;
    if (i & 1)
      median = find(1, (i / 2) + 1);
    else
      median = (find(1, i / 2) + find(1, (i / 2) + 1)) / 2;
    median -= sz;
    ;
    Node half = sum(0, median);
    ;
    L s = ((i + 1) / 2) * median - half.sum;
    half = sum(median + 1, sz - 1);
    ;
    s += half.sum;
    s -= (i / 2) * median;
    ;
    L h1 = (i - 1) / 2;
    s -= (h1 * (h1 + 1) / 2);
    L h2 = i / 2;
    s -= (h2 * (h2 + 1) / 2);
    cout << s + inversions << " ";
  }
  Node sum(int l, int r) {
    l += sz;
    r += sz;
    if (l == r) return tr[l];
    Node ans = tr[l] + tr[r];
    while ((l >> 1) != (r >> 1)) {
      if (~l & 1) ans = ans + tr[l + 1];
      if (r & 1) ans = ans + tr[r - 1];
      l >>= 1;
      r >>= 1;
    }
    return ans;
  }
  int find(int v, int n) {
    if (v >= sz) return v;
    if (tr[v << 1].number >= n)
      return find(v << 1, n);
    else
      return find(v << 1 | 1, n - tr[v << 1].number);
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  VI a(n);
  VI pos(n);
  for (decltype((n)-1) i = (0), i__ = ((n)-1); i <= i__; i++) {
    cin >> a[i];
    pos[--a[i]] = i;
  }
  Tree dszefko(n);
  for (decltype((n)-1) i = (0), i__ = ((n)-1); i <= i__; i++)
    dszefko.Query(i + 1, pos[i]);
  cout << "\n";
}
