#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  long long res = 1;
  a = a % 1000000007;
  while (b > 0) {
    if (b & 1) {
      res = (res * a) % 1000000007;
      b--;
    }
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return res;
}
long long fermat_inv(long long y) { return power(y, 1000000007 - 2); }
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
vector<long long> ctr(200001, 0ll);
int _mergeSort(int arr[], int temp[], int left, int right);
int merge(int arr[], int temp[], int left, int mid, int right);
int mergeSort(int arr[], int array_size) {
  int temp[array_size];
  return _mergeSort(arr, temp, 0, array_size - 1);
}
int _mergeSort(int arr[], int temp[], int left, int right) {
  int mid, inv_count = 0;
  if (right > left) {
    mid = (right + left) / 2;
    inv_count += _mergeSort(arr, temp, left, mid);
    inv_count += _mergeSort(arr, temp, mid + 1, right);
    inv_count += merge(arr, temp, left, mid + 1, right);
  }
  return inv_count;
}
int merge(int arr[], int temp[], int left, int mid, int right) {
  int i, j, k;
  int inv_count = 0;
  i = left;
  j = mid;
  k = left;
  long long lc = 0ll;
  while ((i <= mid - 1) && (j <= right)) {
    if (arr[i] <= arr[j]) {
      ctr[arr[i]] += lc;
      temp[k++] = arr[i++];
    } else {
      lc++;
      temp[k++] = arr[j++];
      inv_count = inv_count + (mid - i);
    }
  }
  while (i <= mid - 1) {
    ctr[arr[i]] += lc;
    temp[k++] = arr[i++];
  }
  while (j <= right) temp[k++] = arr[j++];
  for (i = left; i <= right; i++) {
    arr[i] = temp[i];
  }
  return inv_count;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) {
    int n;
    cin >> n;
    int a[n];
    vector<int> c(n + 1);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      c[a[i]] = i + 1;
    }
    mergeSort(a, n);
    for (int j = 1; j <= n; j++) ctr[j] += ctr[j - 1];
    set<int> s1;
    set<int> s2;
    long long val1 = 0ll;
    for (int j = 1; j <= n; j++) {
      if (j % 2 == 0) {
        s1.insert(c[j]);
        val1 -= c[j];
        auto it = s1.end();
        it--;
        val1 += 2 * (*it);
        s2.insert(*it);
        s1.erase(*it);
      } else {
        if (s2.size() == 0) {
          s1.insert(c[j]);
          val1 -= c[j];
        } else {
          auto it = s2.begin();
          if ((*it) < c[j]) {
            s1.insert((*it));
            val1 -= (2 * (*it));
            s2.erase(*it);
            s2.insert(c[j]);
            val1 += c[j];
          } else {
            s1.insert(c[j]);
            val1 -= c[j];
          }
        }
      }
      auto it = s1.end();
      it--;
      long long val2 = (*it);
      if (j % 2 == 0) val2 = j / 2;
      long long c1 = j / 2;
      val2 -= c1 * (c1 + 1);
      cout << (val2 + val1 + ctr[j]) << " ";
    }
    cout << "\n";
  }
  return 0;
}
