#include <bits/stdc++.h>   int main() {     int n;     std::cin >> n;     std::vector<int> a(n);     std::vector<int> mn(n);     for (int i = 0; i < n; ++i) {       std::cin >> a[i];     }     mn[n - 1] = a[n - 1];     for (int i = n - 2; i >= 0; --i) {       if (a[i] < mn[i + 1]) {         mn[i] = a[i];       } else {         mn[i] = mn[i + 1];       }     }     for (int i = 0; i < n; ++i) {       int left = i;       int right = n - 1;       int val = a[i];       while (left != right) {         int mid = (left + right + 1) / 2;         if (mn[mid] < val) {           left = mid;         } else {           right = mid - 1;         }       }       std::cout << right - i - 1 <<    ;     }     return 0;   }   