#include<bits/stdc++.h>
using namespace std;
int a[3000006];
struct f{
int num;
int d;
};
int main(){
stack<f>s;
stack<int>s2;
int n;cin>>n;
for (int i=1;i<=n;++i)cin>>a[i];
for (int i=n;i>=1;--i){
while (!s.empty()&&s.top().d<=a[i])s.pop();
if (!s.empty())s2.push((s.top().num));
else s2.push(0);
s.push({i,a[i]});
}
while (!s2.empty()){
cout<<s2.top()<<" ";
s2.pop();
}
return 0;
}