#include<bits/stdc++.h>
using namespace std;
const int N=1e6+10;
struct node{
unsigned long long x;
int y;
};
stack<node>q;
int n;
unsigned long long ans;
node tmp;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n;
for(int i=1;i<=n;i++){
cin>>tmp.x;
tmp.y=i;
while(!q.empty()&&q.top().x<=tmp.x){
ans^=q.top().y;
q.pop();
}
ans^=i;
q.push(tmp);
cout<<ans<<"\n";
}
return 0;
}