func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 5, oo = 0x3f3f3f3f, mod = 1e9 + 7;   int a[N], n, tree[N], srt[N], ans[N];   void update(int a, int val) {     while (a <= n) {       tree[a] = max(val, tree[a]);       a += a & -a;     }   }   int query(int a) {     int mx = 0;     while (a > 0) {       mx = max(tree[a], mx);       a -= a & -a;     }     return mx;   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , a + i);       srt[i] = a[i];     }     sort(srt + 1, srt + n + 1);     for (int i = n; i >= 1; i--) {       int idx = lower_bound(srt + 1, srt + n + 1, a[i]) - srt;       update(idx, i);       ans[i] = query(idx - 1);       if (ans[i] == 0)         ans[i]--;       else         ans[i] -= i + 1;     }     for (int i = 1; i <= n; i++) printf( %d  , ans[i]);     return 0;   }   