#pragma GCC optimize("Ofast") #include using namespace std; #define rep(i, n) for(int i = 0; i < (n); ++i) #define all(x) (x).begin(),(x).end() #define ln '\n' constexpr long long MOD = 1000000007LL; //constexpr long long MOD = 998244353LL; typedef long long ll; typedef unsigned long long ull; typedef pair pii; typedef pair pll; template inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; } template inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector A(N); rep(i,N) cin >> A[i]; int M = min(N,22); vector ans(N); map dic; for (int mask = 1; mask < (1<