#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n;
int x[N];
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n;
stack<pair<int,int>> st;
for(int i=1;i<=n;i++){
cin>>x[i];
if(i==1){
st.push({i,i});
cout<<st.top().second<<endl;
}else{
int res=i;
while(!st.empty()&&x[i]>=x[st.top().first]){
st.pop();
}
if(!st.empty()){
res=res^st.top().second;
}
st.push({i,res});
cout<<res<<endl;
}
}
return 0;
}

京公网安备 11010502036488号