#B3666. Suffix Maximum Indices XOR

    ID: 11325 Type: Default 1000ms 256MiB

Suffix Maximum Indices XOR

Suffix Maximum Indices XOR

You are given an initially empty sequence \(a\). There are \(n\) operations. In each operation, a positive integer \(x\) is appended to the end of \(a\).

After each operation, you must find all the suffix maximum indices of the current sequence \(a\). An index \(i\) (1-indexed) is called a suffix maximum index if and only if for every index \(j\) with \(i < j \leq |a|\) (where \(|a|\) is the current length of \(a\)), the following holds:

\[ a_i > a_j \]

After each operation, output an integer representing the bitwise XOR of all the suffix maximum indices.

Note: The newly appended element may affect the previously determined suffix maximum indices.

inputFormat

The first line contains an integer \(n\) \( (1 \le n)\) representing the number of operations. Each of the following \(n\) lines contains a positive integer \(x\), which is appended to the sequence \(a\).

outputFormat

After each operation, output one integer on a new line. This integer is the bitwise XOR of all suffix maximum indices of the current sequence \(a\).

sample

1
3
1

</p>