#include<bits/stdc++.h>
using namespace std ;
stack <int> s ;
int n;
unsigned long long a[1000005] ;
long long ans=0;
int main()
{
cin>>n;
for(int i=1 ;i<=n ;++i)
{
scanf("%lld",&a[i]);
while(!s.empty() && a[s.top()] <=a[i])
{
ans^=s.top(); s.pop();
}
s.push(i) ;
ans^=i;
cout << ans << endl;
}
}
本蒟蒻甚至已经按模板敲了……