#include <bits/stdc++.h>   using namespace std;   template <class T>   T min(T a, T b, T c) {     return min(a, min(b, c));   }   template <class T>   T min(T a, T b, T c, T d) {     return min(a, min(b, min(c, d)));   }   template <class T>   T max(T a, T b, T c) {     return max(a, max(b, c));   }   template <class T>   T max(T a, T b, T c, T d) {     return max(a, max(b, max(c, d)));   }   bool cmp(const pair<int, int>& a, const pair<int, int>& b) {     return (a.first > b.first || (a.first == b.first && a.second >= b.second));   }   long long GCD(long long a, long long b) { return (a % b) ? GCD(b, a % b) : b; }   const string namePro =  tmp ;   int nodes[4 * 1000007];   int a[1000007];   void initIT(int root, int left, int right) {     if (left == right) {       nodes[root] = a[left];       return;     }     int mid = (left + right) / 2;     initIT(2 * root, left, mid);     initIT(2 * root + 1, mid + 1, right);     nodes[root] = min(nodes[2 * root], nodes[2 * root + 1]);     return;   }   int queryIT(int root, int left, int right, int val) {     int mid = (left + right) / 2;     if (left == right) return left;     if (nodes[2 * root + 1] < val)       return queryIT(2 * root + 1, mid + 1, right, val);     else       return queryIT(2 * root, left, mid, val);   }   int main() {     int n;     scanf( %d , &n);     for (int i = (1); i <= (n); ++i) scanf( %d , &a[i]);     initIT(1, 1, n);     for (int i = (1); i <= (n); ++i) {       int k = queryIT(1, 1, n, a[i]);       if (k <= i)         printf( -1  );       else         printf( %d  , k - i - 1);     }     return 0;   }   