#include <bits/stdc++.h>   using namespace std;   int N, A[100001], BIT[100001], res[100001];   vector<int> v;   map<int, int> m;   int main() {     scanf( %d , &N);     for (int i = 1; i <= N; ++i) scanf( %d , &A[i]), v.push_back(A[i]);     sort(v.begin(), v.end());     v.resize(unique(v.begin(), v.end()) - v.begin());     int n = v.size();     for (int i = 0; i < n; ++i) m[v[i]] = i + 1;     for (int i = N; i >= 1; --i) {       int mx = 0;       for (int x = m[A[i]] - 1; x > 0; x -= x & -x)         if (mx < BIT[x]) mx = BIT[x];       res[i] = ((mx - i - 1 >= 0) ? (mx - i - 1) : -1);       for (int x = m[A[i]]; x <= n; x += x & -x)         if (!BIT[x]) BIT[x] = i;     }     for (int i = 1; i <= N; ++i) printf( %d  , res[i]);     return 0;   }   