#include <bits/stdc++.h>
using namespace std;
int N = 200005;
int n;
int k = 1;
vector<int> tree(4 * N);
void update(int x, int id = 1, int l = 0, int r = n - 1) {
  if (x < l) return;
  if (x > r) return;
  if (r == l) {
    tree[id] = 1;
    return;
  }
  int mid = (l + r) / 2;
  tree[id]++;
  if (x <= mid)
    update(x, id * 2, l, mid);
  else
    update(x, id * 2 + 1, mid + 1, r);
}
int query(int xl, int xr, int id = 1, int l = 0, int r = n - 1) {
  if (xr < l) return 0;
  if (r < xl) return 0;
  if (xr >= r && xl <= l) {
    return tree[id];
  }
  int mid = (l + r) / 2;
  int ans = query(xl, xr, id * 2, l, mid);
  ans += query(xl, xr, id * 2 + 1, mid + 1, r);
  return ans;
}
int getmid(int x) {
  int l = 0, r = n;
  int mid;
  for (int i = 0; i < 18; i++) {
    mid = (l + r) / 2;
    int q = query(0, mid);
    if (q < x) {
      l = mid + 1;
    } else {
      r = mid;
    }
  }
  if (query(0, l) == x) return l;
  return mid;
}
int sett(int x) {
  int temp1 = query(x, n - 1);
  int ans = -(min(query(0, x), temp1)) + temp1;
  update(x);
  k++;
  if (k % 2) {
    int md = k / 2 + 1;
    int ind = getmid(md);
    int l = ind;
    int r = x;
    if (l > r) swap(l, r);
    int ones = query(l, r);
    ans += r - l + 1 - ones;
  } else {
    int md = k / 2;
    int ind = getmid(md);
    int ind2;
    if (x <= ind) ind = getmid(md + 1);
    int l = ind;
    int r = x;
    if (l > r) swap(l, r);
    int ones = query(l, r);
    ans += r - l + 1 - ones;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int k;
  cin >> k;
  n = k + 2;
  map<int, int> mp;
  for (int i = 1; i <= k; i++) {
    int temp;
    cin >> temp;
    mp[temp] = i;
  }
  long long ans = 0;
  update(mp[1]);
  cout << ans << " ";
  for (int i = 2; i <= k; i++) {
    ans += sett(mp[i]);
    cout << ans << " ";
  }
  cout << endl;
  return 0;
}
