#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 111;
int n, perm[N];
struct tree {
  vector<long long> a;
  tree() { a.assign(N * 4, 0); }
  void upd(int id, int l, int r, int k, int value) {
    if (l == r) {
      a[id] = value;
      return;
    }
    int mid = (l + r) / 2;
    if (k <= mid)
      upd(id * 2, l, mid, k, value);
    else
      upd(id * 2 + 1, mid + 1, r, k, value);
    a[id] = a[id * 2] + a[id * 2 + 1];
  }
  long long getSum(int id, int l, int r, int u, int v) {
    if (l > v || r < u) return 0;
    if (u <= l && r <= v) return a[id];
    int mid = (l + r) / 2;
    long long tmp = getSum(id * 2, l, mid, u, v);
    return tmp + getSum(id * 2 + 1, mid + 1, r, u, v);
  }
  int getNode(int id, int l, int r, int k) {
    if (l == r) return l;
    int mid = (l + r) / 2;
    if (a[id * 2] >= k) return getNode(id * 2, l, mid, k);
    return getNode(id * 2 + 1, mid + 1, r, k - a[id * 2]);
  }
} it1, it2;
int pos[N];
long long res[N];
void solve() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> perm[i];
    pos[perm[i]] = i;
  }
  long long tmp = 0;
  for (int i = 1; i <= n; ++i) {
    tmp += it1.getSum(1, 1, n, pos[i] + 1, n);
    it1.upd(1, 1, n, pos[i], 1);
    it2.upd(1, 1, n, pos[i], pos[i]);
    res[i] = tmp;
    if (i == 1) continue;
    int cnt1 = (i + 1) / 2;
    int cnt2 = i - cnt1;
    int k = it1.getNode(1, 1, n, cnt1);
    res[i] += 1LL * k * cnt1 - it2.getSum(1, 1, n, 1, k);
    res[i] += it2.getSum(1, 1, n, k + 1, n) - 1LL * k * cnt2;
    res[i] -= 1LL * cnt1 * (cnt1 - 1) / 2;
    res[i] -= 1LL * cnt2 * (cnt2 + 1) / 2;
  }
  for (int i = 1; i <= n; ++i) cout << res[i] << " ";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
