#include <iostream>
using namespace std;
typedef unsigned long long ll;
const int N = 1000010;
ll stk[N], ans;
int tt, n;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int i = 1; i <= n; i++) {
ll x;
cin >> x;
if(tt && stk[tt] <= x) ans = i;
if(!tt || stk[tt] > x) ans ^= i;
stk[++tt] = x;
cout << ans << endl;
}
return 0;
}