#include <bits/stdc++.h>
using namespace std;
const int N = 2E5 + 10;
const int inf = 1 << 30;
long long read() {
  long long a = 0;
  char b = 1, c;
  do
    if ((c = getchar()) == 45) b = -1;
  while (c < 48 || c > 57);
  do a = (a << 3) + (a << 1) + (c & 15);
  while ((c = getchar()) > 47 && c < 58);
  return a * b;
}
void write(long long x, char c) {
  if (x < 0) putchar('-'), x = -x;
  char a[20], s = 0;
  do a[++s] = x % 10 | 48;
  while (x /= 10);
  do putchar(a[s]);
  while (--s);
  putchar(c);
}
int a[N], b[N], n;
priority_queue<int, vector<int>, greater<int>> q1;
priority_queue<int> q2;
void push(int x) {
  if (x > q2.top())
    q1.push(x);
  else
    q2.push(x);
  while (x <= n) {
    ++b[x];
    x += x & -x;
  }
}
int ask(int x) {
  int res = 0;
  while (x) {
    res += b[x];
    x -= x & -x;
  }
  return res;
}
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) a[read()] = i;
  long long ans = 0;
  q1.push(n);
  q2.push(1);
  for (int i = 1, w = a[1]; i <= n; ++i) {
    int t = a[i];
    push(t);
    int at = ask(t), aw = ask(w);
    ans += i - at;
    if (t > w) {
      ans += t - w + aw - i;
    } else {
      ans += w - t - aw + 1;
    }
    if (i & 1) {
      int k = q1.size() - q2.size() - 1;
      if (k > 0) {
        q2.push(q1.top());
        q1.pop();
      } else if (k < 0) {
        q1.push(q2.top());
        q2.pop();
      }
      int y = q1.top();
      if (y != w) {
        ans -= abs(w - y) - 1;
      }
      w = y;
    }
    write(ans, ' ');
  }
}
