#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int n, p[N], pos[N];
struct SegmentTree {
  int lz[N << 2];
  int cnt[N << 2];
  long long sum[N << 2];
  void lazy(int v, int l, int r) {
    if (!lz[v]) return;
    if (l < r) lz[v << 1] += lz[v], lz[v << 1 | 1] += lz[v];
    sum[v] += 1LL * (r - l + 1) * lz[v];
    lz[v] = 0;
  }
  void upd_sum(int v, int l, int r, int L, int R) {
    lazy(v, l, r);
    if (R < l || L > r) return;
    if (L <= l && r <= R) {
      lz[v] = 1;
      lazy(v, l, r);
      return;
    }
    upd_sum(v << 1, l, ((l + r) >> 1), L, R);
    upd_sum(v << 1 | 1, ((l + r) >> 1) + 1, r, L, R);
    sum[v] = sum[v << 1] + sum[v << 1 | 1];
  }
  void upd_pos(int v, int l, int r, int p) {
    if (p < l || r < p) return;
    if (l == r) {
      cnt[v] = 1;
      return;
    }
    upd_pos(v << 1, l, ((l + r) >> 1), p);
    upd_pos(v << 1 | 1, ((l + r) >> 1) + 1, r, p);
    cnt[v] = cnt[v << 1] + cnt[v << 1 | 1];
  }
  int get_cnt(int v, int l, int r, int L, int R) {
    if (R < l || L > r) return 0;
    if (L <= l && r <= R) return cnt[v];
    return get_cnt(v << 1, l, ((l + r) >> 1), L, R) +
           get_cnt(v << 1 | 1, ((l + r) >> 1) + 1, r, L, R);
  }
  long long get_sum(int v, int l, int r, int L, int R) {
    lazy(v, l, r);
    if (R < l || L > r) return 0;
    if (L <= l && r <= R) return sum[v];
    return get_sum(v << 1, l, ((l + r) >> 1), L, R) +
           get_sum(v << 1 | 1, ((l + r) >> 1) + 1, r, L, R);
  }
  int find_kth(int v, int l, int r, int k) {
    if (l == r) return l;
    if (cnt[v << 1] >= k)
      return find_kth(v << 1, l, ((l + r) >> 1), k);
    else
      return find_kth(v << 1 | 1, ((l + r) >> 1) + 1, r, k - cnt[v << 1]);
  }
} seg;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> p[i];
    pos[p[i]] = i;
  }
  long long inv = 0;
  for (int k = 1; k <= n; ++k) {
    inv += seg.get_cnt(1, 1, n, pos[k], n);
    seg.upd_pos(1, 1, n, pos[k]);
    seg.upd_sum(1, 1, n, pos[k], n);
    int median = seg.find_kth(1, 1, n, (k + 1) / 2);
    int cnt_left = (k + 1) / 2;
    long long sum_left = seg.get_sum(1, 1, n, 1, median);
    int cnt_right = k - cnt_left;
    long long sum_right = 1LL * k * (n - median - cnt_right) -
                          (seg.sum[1] - sum_left) +
                          1LL * cnt_right * (k + cnt_left + 1) / 2;
    sum_left -= 1LL * cnt_left * (cnt_left + 1) / 2;
    printf("%lld ", inv + sum_left + sum_right);
  }
  printf("\n");
}
