#include <bits/stdc++.h>
using namespace std;
int arr[1000000];
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
bool flag=false;
cin>>arr[i];
for(int j=i;j>=1;j--){
if(arr[j]>arr[i]){
cout<<j<<"\n";
flag=true;
break;
}
}
if(!flag){
cout<<-1<<"\n";
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBhcnJbMTAwMDAwMF07CmludCBtYWluKCl7CglpbnQgbjsKCWNpbj4+bjsKCWZvcihpbnQgaT0xO2k8PW47aSsrKXsKCQlib29sIGZsYWc9ZmFsc2U7CgkJY2luPj5hcnJbaV07CgkJZm9yKGludCBqPWk7aj49MTtqLS0pewoJCQlpZihhcnJbal0+YXJyW2ldKXsKCQkJCWNvdXQ8PGo8PCJcbiI7CgkJCQlmbGFnPXRydWU7CgkJCQlicmVhazsKCQkJfQoJCX0KCQlpZighZmxhZyl7CgkJCWNvdXQ8PC0xPDwiXG4iOwoJCX0KCX0KCXJldHVybiAwOwp9