import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意 hasNext 和 hasNextLine 的区别
int count = in.nextInt();
int[][] stack = new int[count][2];
int top = 0;
long result = 0;
for(int i = 1; i <= count; i++){
int ele = in.nextInt();
while(top!=0&&stack[top-1][1]<=ele){
result ^= stack[--top][0];
}
stack[top][0]=i;
stack[top][1]=ele;
top++;
result ^=i;
System.out.println(result);
}
}
}

京公网安备 11010502036488号