Consider an array of k integers b_1,b_2,…,b_k. Let x⊕y be the bitwise exclusive OR of x and y. We shall say the linear power of the array b is LP(b)=max_i=0,1,…,k(b_1⊕…⊕b_i)+(b_i+1⊕…⊕b_k).
You are given an array a of n integers. Find the linear power of all its prefixes.
The first line contains a positive integer n (1≤n≤106), the length of the array.
The second line contains n integers a_i (0≤a_i≤106).
Output a single line containing n space-separated integers: LP(a_1), LP(a_1,a_2), …, LP(a_1,a_2,…,a_n).