New Divide

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Consider an array of kk integers b_1,b_2,,b_kb\_1, b\_2, \ldots, b\_k. Let xyx \oplus y be the bitwise exclusive OR of xx and yy. We shall say the linear power of the array bb is LP(b)=max_i=0,1,,k(b_1b_i)+(b_i+1b_k).\mathit{LP} (b) = \max\limits\_{i = 0, 1, \ldots, k} (b\_1 \oplus \ldots \oplus b\_i) + (b\_{i + 1} \oplus \ldots \oplus b\_k)\text{.}

You are given an array aa of nn integers. Find the linear power of all its prefixes.

입력

The first line contains a positive integer nn (1n1061 \le n \le 10^6), the length of the array.

The second line contains nn integers a_ia\_i (0a_i1060 \le a\_i \le 10^6).

출력

Output a single line containing nn space-separated integers: LP(a_1)\mathit{LP} (a\_1), LP(a_1,a_2)\mathit{LP} (a\_1, a\_2), \ldots, LP(a_1,a_2,,a_n)\mathit{LP} (a\_1, a\_2, \ldots, a\_n).