#include <bits/stdc++.h>   using namespace std;   const long long inf = 1000000001;   void run_case() {     long long n;     cin >> n;     vector<pair<long long, long long>> v;     for (long long i = 0; i < n; i++) {       long long x;       cin >> x;       v.push_back({x, i});     }     sort(v.begin(), v.end());     vector<long long> curr_max(n), maxi(n), ans(n);     curr_max[0] = v[0].second;     maxi[0] = v[0].second;     ans[v[0].second] = -1;     for (long long i = 1; i < n; i++) {       curr_max[i] = max(curr_max[i - 1], v[i].second);       if (v[i].first == v[i - 1].first)         maxi[i] = maxi[i - 1];       else         maxi[i] = curr_max[i];       ans[v[i].second] = maxi[i] - v[i].second - 1;     }     for (long long i = 0; i < n; i++) {       cout << max(ans[i], -1ll) <<    ;     }     cout << endl;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long tc = 1;     while (tc--) run_case();     return 0;   }   