#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include using namespace std; int dp[16][700000]; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin>>n; vector A(n); rep(i,n) cin>>A[i]; if(n>=16){ cout<<(1<<16)-1< B(16); B[0]=A[i]; for(int j=1;j<16;j++){ B[j]=B[j-1]/2; if(B[j-1]%2) B[j]+=(1<<15); } for(int j=0;j<(1<<16);j++){ for(int k=0;k<16;k++){ dp[i+1][j|B[k]]|=dp[i][j]; } } } int ma=0; for(int i=0;i<(1<<16);i++){ if(dp[n][i]) ma=i; } cout<