#include "bits/stdc++.h" using namespace std; #define int long long #define REP(i,n) for(int i = 0;i < (int)(n);i++) #define RREP(i,n) for(int i = (int)n-1;i >= 0;i--) #define FOR(i,s,n) for(int i = s;i < (int)n;i++) #define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--) #define ALL(a) a.begin(),a.end() templateinline void out(T t){cout<inline void out(T t,Ts... ts){cout<inline bool CHMAX(T&a,T b){if(ainline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;} constexpr long long INF = 1e18; #define ull unsigned long long ull gcd(ull x,ull y) { if(x==0) return y; return gcd(y%x,x); } int lcm(int x, int y) { return (x * y / gcd(x, y)); } vector > prime_factorize(long long n) { vector > res; for (long long p = 2; p * p <= n; ++p) { if (n % p != 0) continue; int num = 0; while (n % p == 0) { ++num; n /= p; } res.push_back(make_pair(p, num)); } if (n != 1) res.push_back(make_pair(n, 1)); return res; } long long mod_pow(long long x, long long n) { long long res = 1; while (n > 0) { if (n & 1) res = res * x; x = x * x; n >>= 1; } return res; } signed main(){ int N; cin >> N; vectora(1ll << 20); vectorok(1ll << 20); REP(i,N){ cin >> a[i]; if(a[i] == -1)ok[i] = 1; } REP(k,20){ REP(s,N){ if(!((s>>k)&1)){ if(ok[s^(1ll<