#include <iostream>
#pragma GCC optimize("O3,unroll-loops")
#include <algorithm>
#include <cstring>
#include <climits>
#include <iomanip>
#include <numeric>
#include <bitset>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
//#define int long long
//#define int short
#define pb push_back
#define f first
#define s second
using namespace std;

vector<int> solve(vector<int> v){
    map<int, int> M;
    sort(v.begin(), v.end());
    int n = v.size();
    for (auto i : v){
        M[i]++;
    }
    bool t1 = true;
    for (auto i : M){
        if (i.s % 2 == 1){
            t1 = false;
        }
    }
    bool t2 = true;
    for (auto i : M){
        for (int j = 0; j <= 30; j++){
            if (i.f == (1 << j)){
                break;
            }
        }
        t2 = false;
    }
    bool t3 = true;;
    for (int i = 1; i < n; i++){
        if (v[i] != v[i - 1] + 1){
            t3 = true;
        }
    }
    vector<int> rez;
    if (t1){
        for (int idk = 1; idk <= 2; idk++){
            for (auto i : M){
                for (int j = 1; j <= i.s / 2; j++){
                    rez.pb(i.f);
                }
            }
        }
    }
    if (t2){
        for (int i = 0; i < n / 2; i++){
            rez.pb(v[i]);
        }
        rez.pb(v[n - 1]);
        for (int i = n / 2; i < n - 1; i++){
            rez.pb(v[i]);
        }
    }
    return rez;
}

