Or Max

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

문제

bobo has a sequence a_1,a_2,,a_na\_1, a\_2, \dots, a\_n. He would like to choose kk consecutive elements and maximize the value SS that is defined as their maximum plus their bitwise or.

For all 1kn1 \leq k \leq n, find the maximal value bobo can achieve.

입력

The first line contains an integer nn (1n1051 \leq n \leq 10^5).

The second line contains nn integers a_1,a_2,,a_na\_1, a\_2, \dots, a\_n (0a_i<2160 \leq a\_i < 2^{16}).

출력

nn integers, where the ii-th integer is maximal SS for k=ik=i.