#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

using namespace std;

#define endl '\n'
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

typedef long long int ll;
#define forn(i, n) for (int i = 0; i < int(n); i++)

ll modExp(int a, int k, ll MOD)
{
    ll r = 1, t = a;
    while (k)
    {
        if (k & 1)
            r = r * t % MOD;
        t = t * t % MOD;
        k >>= 1;
    }
    return r;
}

ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
        return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
        x += m0;
    return x;
}

//use to find kth smallest element in int set, insert with ob.insert(int), find rank with *ob.find_by_order(k-1)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;  

void print(int ar[], int n)
{
    for (int i = 0; i < n;i++)
    {
        cout << ar[i];
    }
}


int main()
{
    fast_io
    
    int n;
    cin >> n;

    int ar[n + 1];
    int rev[n + 1];
    ar[0] = 0, rev[0] = 0;
    for (int i = 1; i <= n;i++)
    {
        cin >> ar[i];
        rev[ar[i]] = i;
    }
    auto centre=rev[1];
    int num1 = 0;
    int num2 = 0;
    ordered_set work;
    work.insert(rev[1]);
    cout << num1 + num2 << " ";
    for (int i = 2; i <= n; i++)
    {
        if(work.size()%2==1)
        {
            work.insert(rev[i]);
            num1 += abs(rev[i] - centre) - 1 - work.size() / 2 +1;
            num2 += work.size() - (work.order_of_key(rev[i]) + 1);
            cout << num1 + num2 << " ";
        }
        else
        {
            work.insert(rev[i]);
            int posc = work.order_of_key(centre) + 1;
            int posi = work.order_of_key(rev[i])+1;

            if (2*posc-1 != work.size())
            {
                auto iter = work.find(centre);
                if (posi < posc)
                {
                   
                    centre = *(--iter);
                }
                else
                {
                    centre = *(++iter);
                }

            }

            num1 += abs(rev[i] - centre) - 1 - (work.size() - 1) / 2 + 1;
            num2 += work.size() - (posi);
            cout << num1 + num2 << " ";
        }
        cout << endl;
    }
}
