bobo has a sequence a_1,a_2,…,a_n. He would like to choose k consecutive elements and maximize the value S that is defined as their maximum plus their bitwise or.
For all 1≤k≤n, find the maximal value bobo can achieve.
The first line contains an integer n (1≤n≤105).
The second line contains n integers a_1,a_2,…,a_n (0≤a_i<216).
n integers, where the i-th integer is maximal S for k=i.