#include <bits/stdc++.h>
using namespace std;
const int INF = 1061109567;
const long long LINF = 4557430888798830399ll;
const int MOD = 1000000007;
long long qpow(long long x, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
struct SegmentTree {
  static const int MAXN = 200000;
  int st[(MAXN << 2) + 5];
  void PushUp(int o) { st[o] = st[(o << 1)] + st[(o << 1 | 1)]; }
  void Build(int o, int l, int r) {
    if (l == r)
      st[o] = 0;
    else {
      int m = l + r >> 1;
      Build((o << 1), l, m);
      Build((o << 1 | 1), m + 1, r);
      PushUp(o);
    }
  }
  void Update(int o, int l, int r, int p, int v) {
    if (l == r) {
      st[o] += v;
      return;
    } else {
      int m = l + r >> 1;
      if (p <= m) Update((o << 1), l, m, p, v);
      if (p >= m + 1) Update((o << 1 | 1), m + 1, r, p, v);
      PushUp(o);
    }
  }
  int Query(int o, int l, int r, int ql, int qr) {
    if (ql <= l && r <= qr) {
      return st[o];
    } else {
      int m = l + r >> 1;
      int res = 0;
      if (ql <= m) res = res + Query((o << 1), l, m, ql, qr);
      if (qr >= m + 1) res = res + Query((o << 1 | 1), m + 1, r, ql, qr);
      return res;
    }
  }
} st;
int n;
int a[200005];
int p[200005];
int ans[200005];
void test_case() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    p[a[i]] = i;
  }
  st.Build(1, 1, n);
  int Lmost = p[1], Rmost = p[1], cnt = 0;
  st.Update(1, 1, n, p[1], 1);
  ans[1] = 0;
  for (int i = 2; i <= n; ++i) {
    if (p[i] < Lmost) Lmost = p[i];
    if (p[i] > Rmost) Rmost = p[i];
    cnt += st.Query(1, 1, n, p[i], n);
    st.Update(1, 1, n, p[i], 1);
    ans[i] = (Rmost - Lmost + 1 - i) + cnt;
  }
  for (int i = 1; i <= n; ++i) printf("%d%c", ans[i], " \n"[i == n]);
}
int main() {
  int t = 1;
  for (int ti = 1; ti <= t; ++ti) {
    test_case();
  }
}
