#include <bits/stdc++.h>
using namespace std;
int s[200005], sum[200005], ara[200005], p[200005];
void add(int x, int n) {
  while (x <= n) {
    sum[x]++;
    x += (x & -x);
  }
  return;
}
int query(int x) {
  int ret = 0;
  while (x) {
    ret += sum[x];
    x -= (x & -x);
  }
  return ret;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &ara[i]), p[ara[i]] = i;
  for (int i = 1; i <= n; i++) s[i] = query(n) - query(p[i]), add(p[i], n);
  printf("0");
  int mn = p[1], mx = p[1];
  long long tot = 0;
  for (int i = 2; i <= n; i++) {
    tot += s[i];
    mn = min(mn, p[i]);
    mx = max(mx, p[i]);
    tot += (mx - mn + 1 - i);
    printf(" %lld", tot);
  }
  puts("");
  return 0;
}
