#include using namespace std; #define endl '\n' #define ALL(a) (a).begin(),(a).end() #define ALLR(a) (a).rbegin(),(a).rend() #define spa << " " << #define test cout<<"test"<= (ll)(n); i--) using ll = long long; using ld = long double; const ll MOD = 1e9+7; //const ll MOD = 998244353; const ll INF = 1e18; using P = pair; template void chmin(T &a,T b){if(a>b)a=b;} template void chmax(T &a,T b){if(a void ans(bool x,T1 y,T2 z){if(x)cout< void debug(vector>&v,ll h,ll w){for(ll i=0;i&v,ll h,ll w){for(ll i=0;i void debug(vector&v,ll n){if(n!=0)cout< vector>vec(ll x, ll y, T w){ vector>v(x,vector(y,w));return v;} ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;} vectordx={1,0,-1,0,1,1,-1,-1}; vectordy={0,1,0,-1,1,-1,1,-1}; template vector make_v(size_t a,T b){return vector(a,b);} template auto make_v(size_t a,Ts... ts){ return vector(a,make_v(ts...)); } ostream &operator<<(ostream &os, pair&p){ return os << p.first << " " << p.second; } const ll MAX_W=110000; struct BitMatrix { ll h,w; vector>A; BitMatrix() {}; BitMatrix(ll n, ll m) :h(n),w(m){ A.assign(h,bitset(0)); }; BitMatrix(vector>v):h(v.size()),w(v[0].size()){ A.assign(h,bitset(0)); for(ll i=0;i &operator[](ll k) { return A[k]; } friend ostream &operator<<(ostream &os, BitMatrix &p) { ll n = p.height(), m = p.width(); for(ll i = 0; i < n; i++) { os << "["; for(ll j = 0; j < m; j++) { os << p[i][j] << (j + 1 == m ? "]\n" : ","); } } return (os); } }; setst; ll GaussJordan(BitMatrix &a, bool is_extended){ ll h = a.height(), w = a.width(); ll rank = 0; ll limit = w - is_extended; for(ll col=0;col>n; vectora(n); rep(i,0,n)cin>>a[i]; ll minbit=INF; vectornum(100001); vectort(100001); rep(i,0,n){ bitset<20>x=a[i]; res+=a[i]; num[a[i]]++; for(ll j=a[i];j<=100000;j*=2){ t[j]=true; } } ll cnt=0; rep(i,0,100001)if(t[i])cnt++; BitMatrix mat(20,cnt); cnt=0; rep(i,0,100001){ if(t[i]){ //cout<x=i; rep(j,0,20)if(x[j])mat[j][cnt]=1; cnt++; } } //cout<y=a[0]; rep(i,1,100001){ bitset<20>x=i; ll minbuf=INF; judge=true; rep(j,0,20){ if(!st.count(j)&&x[j]!=y[j])judge=false; } if(!judge)continue; ll sumbuf=0; for(ll j=i;j<=100000;j+=i){ sumbuf+=(j-j/i)*num[j]; } //if(i<=30)cout<