func_code_string: #include <bits/stdc++.h>   using namespace std;   inline int gc() {     static const int BUF = 1e7;     static char buf[BUF], *bg = buf + BUF, *ed = bg;     if (bg == ed) fread(bg = buf, 1, BUF, stdin);     return *bg++;   }   inline int ri() {     int x = 0, f = 1, c = gc();     for (; c < 48 || c > 57; f = c ==  -  ? -1 : f, c = gc())       ;     for (; c > 47 && c < 58; x = x * 10 + c - 48, c = gc())       ;     return x * f;   }   const int inf = 0x3f3f3f3f;   const long long infLL = 0x3f3f3f3f3f3f3f3fLL;   const long long mod = 1e9 + 7;   const int maxN = 1e5 + 7;   int n;   int a[maxN];   int ans[maxN];   int BinarySearch(vector<int>& x, int k) {     if (x.size() == 0 || a[x[0]] >= k) return -1;     int l = 0, r = x.size() - 1;     int mid = (l + r) >> 1;     while (l < r) {       if (a[x[mid]] >= k) {         r = mid - 1;         mid = (l + r) >> 1;       } else {         l = mid + 1;         if (a[x[l]] >= k) return x[mid];         mid = (l + r) >> 1;       }     }     return x[r];   }   int main() {     while (cin >> n) {       for (int i = (1); i <= (n); ++i) cin >> a[i];       vector<int> vi;       for (int i = (1); i <= (n); ++i) {         if (vi.empty() || a[i] > a[vi.back()]) {           vi.push_back(i);         } else if (a[i] <= a[vi.back()]) {           vi.pop_back();           --i;         }       }       for (int i = (1); i <= (n); ++i) {         ans[i] = BinarySearch(vi, a[i]);         ans[i] -= i + 1;         if (ans[i] < 0) ans[i] = -1;         cout << ans[i] <<    ;       }     }     return 0;   }   