#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	long double ed = 0;
	ll md = 0,cd = 0;
	for(int i = 0; i < n;++i){
		ll x;
		cin >> x;
		cd = max(cd,abs(x));
		md = md + abs(x);
		ed = ed + (long double)(x*x);
	}
	ed = sqrt(ed);
	cout << md << "\n";
	cout << fixed  << setprecision(15) << ed << "\n";
	cout <<  cd << "\n";
}

#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define ROF(i,a,b) for(int i=(a); i>=(b); --i)
#define pb push_back
#define eb emplace_back
#define SZ(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define make_unique(a) sort(all((a))), (a).erase(unique(all((a))),(a).end())
#define x first
#define y second
#define MP make_pair
#define MT make_tuple
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) FOR(i,1,y) cout << "##"; cout << #x << " = " << x << endl

using namespace std;

typedef long long i64;
typedef tuple<int,int,int> iii;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long double ld;

int readInt(){ int a; scanf("%d",&a); return a; }
i64 readLong(){ i64 a; scanf("%lld",&a); return a;}
void readString(char *s){ scanf(" %s",s); }

const int mod = 998244353;
int add(int a, int b){ return ((a+=b)>=mod)?a-mod:a; }
void adding(int &a, int b){ a = add(a,b); }
int mul(int a, int b){ return a*1ll*b%mod; }
int pw(int a, int b){
	int res = a, ans = 1;
	for(int i=1;i<=b;i<<=1,res=mul(res,res)){
		if(i&b) ans = mul(ans, res);
	}
	return ans;
}

int main(){
	i64 n = readLong();
	i64 ans = LLONG_MAX;
	FOR(i, 0, 59){
		ans = min(ans, i+n/(1ll<<i)+(n&((1ll<<i)-1)));
	}
	printf("%lld",ans);
	return 0;
}
// 1


#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#endif
#if __has_include(<atcoder/all>)
#include <atcoder/all>
#endif
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, ll>;
#define rep(i, a, b) for(int i = (int)(a); i <= (int)(b); i++)
#define rrep(i, a, b) for(int i = (int)(a); i >= (int)(b); i--)
const int MOD = 1000000007;
const int MOD2 = 998244353;
const ll INF = 1e18;
const ld PI = acos(-1);

class UnionFind {
public:
    vector<int> par;
    vector<int> rnk;
    vector<ll> siz;
    vector<int> isequal;
    UnionFind(int N): par(N), rnk(N), siz(N), isequal(N){
        for(int i = 0; i < N; i++){
            par[i] = i, rnk[i] = 0, siz[i] = 1;
        }
    }
    //根
    int find(int x){
        if(par[x] ==x )return x;
        return par[x] = find(par[x]);
    }
    void unite(int x, int y){
        int rx = find(x);
        int ry = find(y);
        if (rx == ry) return;
        if(rnk[rx] < rnk[ry]){
            par[rx] = ry;
            siz[ry] += siz[rx];
            siz[rx] = 0;
        }
        else{
            par[ry] = rx;
            siz[rx] += siz[ry];
            siz[ry] = 0;
            if(rnk[rx] == rnk[ry]){
                rnk[rx]++;
            }
        }
    }
    //集合が同じか
    bool same(int x, int y){
        return find(x) == find(y);
    }
    //集合の大きさ
    ll size(int x){
        return siz[find(x)];
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,Q;
    cin >> N;
    vector<ll> A(N),T(N);
    ll delta=0;
    rep(i,0,N-1){
        cin >> A[i] >> T[i];
        if(T[i]==1) delta+=A[i];
    }
    cin >> Q;
    vector<int> X(Q);
    rep(i,0,Q-1){
        cin >> X[i];
    }
    ll mx=INF,mn=-INF;
    rep(i,0,N-1){
        if(T[i]==1){
            mx+=A[i];
            mn+=A[i];
        }
        else if(T[i]==2){
            mx=max(A[i],mx);
            mn=max(A[i],mn);
        }
        else if(T[i]==3){
            mx=min(A[i],mx);
            mn=min(A[i],mn);
        }
    }
    /*cout << delta << endl;
    cout << mx << ' ' << mn << endl;*/
    rep(i,0,Q-1){
        if(X[i]+delta>=mx){
            cout << mx << endl;
        }
        else if(X[i]+delta<=mn){
            cout << mn << endl;
        }
        else{
            cout << X[i]+delta << endl;
        }
    }
}

#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
#include<iostream>
#include<cstring>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int mod = 998244353;
const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	int pn = 1;
	if (*ci == '-') {
		pn = -pn;
		ci++;
	}
	ll tmp = *(ll*)ci;
	if ((tmp & ma0) ^ ma0) {
		int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
		tmp = tmp << dig & ma1;
		tmp = tmp * 10 + (tmp >> 8) & ma2;
		tmp = tmp * 100 + (tmp >> 16) & ma3;
		tmp = tmp * 10000 + (tmp >> 32) & ma4;
		ci += (72 - dig >> 3);
	}
	else {
		tmp = tmp & ma1;
		tmp = tmp * 10 + (tmp >> 8) & ma2;
		tmp = tmp * 100 + (tmp >> 16) & ma3;
		tmp = tmp * 10000 + (tmp >> 32) & ma4;
		ci += 8;
		if ((ct = *ci++) >= '0') {
			tmp = tmp * 10 + ct - '0';
			if (*ci++ == '0') {
				tmp = tmp * 10;
				ci++;
			}
		}
	}
	return pn * tmp;
}
//constexprあり16桁まで
const int MAX = 10000;
class shuturyoku_unko {
public:
	char C[MAX * 5];
	constexpr shuturyoku_unko() : C() {
		rep(i, MAX) {
			int X = i;
			rep(j, 4) {
				C[i * 5 + 3 - j] = '0' + X % 10;
				X /= 10;
			}
			C[i * 5 + 4] = '\n';
		}
	}
};
constexpr shuturyoku_unko f;
const int dm = 1 << 17;
char dn[dm], * di = dn, * owad = dn + dm - 20;
void putint(ll A) {
	if (owad < di) {
		fwrite(dn, 1, di - dn, stdout);
		di = dn;
	}
	if (A < 0) {
		A = -A;
		*di++ = '-';
	}
	int dig = 1;
	if (A >= 100000000) {
		if (A >= 1000000000000) {
			if (A >= 1000000000000000) dig = 4;
			else if (A >= 100000000000000) dig = 3;
			else if (A >= 10000000000000) dig = 2;
			memcpy(di + 8 + dig, f.C + A % 10000 * 5, 5);
			A /= 10000;
			memcpy(di + 4 + dig, f.C + A % 10000 * 5, 4);
			A /= 10000;
			memcpy(di + dig, f.C + A % 10000 * 5, 4);
			memcpy(di, f.C + A / 10000 * 5 + 4 - dig, dig);
			di += 13 + dig;
		}
		else {
			if (A >= 100000000000) dig = 4;
			else if (A >= 10000000000) dig = 3;
			else if (A >= 1000000000) dig = 2;
			memcpy(di + 4 + dig, f.C + A % 10000 * 5, 5);
			A /= 10000;
			memcpy(di + dig, f.C + A % 10000 * 5, 4);
			memcpy(di, f.C + A / 10000 * 5 + 4 - dig, dig);
			di += 9 + dig;
		}
	}
	else {
		if (A >= 10000) {
			if (A >= 10000000) dig = 4;
			else if (A >= 1000000) dig = 3;
			else if (A >= 100000) dig = 2;
			memcpy(di + dig, f.C + A % 10000 * 5, 5);
			memcpy(di, f.C + A / 10000 * 5 + 4 - dig, dig);
			di += 5 + dig;
		}
		else {
			if (A >= 1000) dig = 4;
			else if (A >= 100) dig = 3;
			else if (A >= 10) dig = 2;
			memcpy(di, f.C + A * 5 + 4 - dig, dig + 1);
			di += 1 + dig;
		}
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N = getint();

	ll L = -1e16, R = 1e16;
	ll ima = 0;
	rep(i, N) {
		int a = getint();
		char t = *ci;
		ci += 2;
		if (t == '1') {
			ima += a;
		}
		else if (t == '2') {
			if (L < a - ima) L = a - ima;
			if (R < L) R = L;
		}
		else {
			if (a - ima < R) R = a - ima;
			if (R < L) L = R;
		}
	}

	int Q = getint();
	rep(i, Q) {
		ll tmp = getint();
		if (tmp > R) tmp = R;
		if (tmp < L) tmp = L;
		putint(tmp + ima);
	}
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    unsigned long long n, res = 1e18; cin >> n;
    for (int i = 63; i >= 0; i--)
        res = min(res, n / (1ll << i) + i + n % (1ll << i));
    cout << res;
}

#include <bits/stdc++.h>
using namespace std;

typedef multiset<string> mss;
typedef map<int, int> mii;
typedef set<string> ss;
typedef vector<int> vi;

int main(void){
		string S;
		cin >> S;
		string T;

    bool isReverse = false;
    for(int i = 0; i < S.size(); i++) {
        if(S[i] == 'R') isReverse = !isReverse;
        else {
					if(isReverse) {
                T = S[i] + T;
                int l = T.size();
                if(l > 1 && T[0] == T[1]) {
                    // console.log(T.substr(0, l-2))
                    T = T.substr(2);
                }
          } else {
              T += S[i];
              int l = T.size();
              if(l > 1 && T[l-2] == T[l-1]) {
                  // console.log(T.substr(0, l-2))
                  T = T.substr(0, l-2);
              }
          }
        }
    }

    auto print = [](string s, bool isReverse) {
    	if(isReverse) {
    		reverse(s.begin(), s.end());
	    	for(char c: s) cout << c;
    	} else {
	    	for(char c: s) cout << c;
    	}
    };
    print(T, isReverse);
}


#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using P = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

enum queryType { SUM, MAX, MIN };
template<typename T>
struct SegTree {
  int n;
  T init; // 単位元(初期値)
  vector<T> node;
  function<T(T&, T&)> calc; // 子ノード2つから親ノードのデータにする処理
  SegTree(int sz, queryType qtype) : n(1) {
    // 初期値と処理関数の設定
    switch (qtype) {
      case SUM:
        init = 0;
        calc = [](T& v1, T& v2) { return v1 + v2; };
        break;
      case MAX:
        init = std::numeric_limits<T>::lowest();
        calc = [](T& v1, T& v2) { return (v1 > v2) ? v1 : v2; };
        break;
      case MIN:
        init = std::numeric_limits<T>::max();
        calc = [](T& v1, T& v2) { return (v1 < v2) ? v1 : v2; };
        break;
    }
    while (n < sz) n *= 2; // 最下段のノード数は2のべき乗(n)
    node.resize(2 * n - 1, init); // セグメント木全体で必要なノード数は2n-1個である
  }
  SegTree(vector<T>& v, queryType qtype) : SegTree(v.size(), qtype) {
    // 最下段に値を入れたあとに、下の段から順番に値を入れる
    // 値を入れるには、自分の子の2値を参照すれば良い
    // ノードiの親は(i-1)/2、子は(2i+1,2i+2)で見つける
    for (int i = 0; i < v.size(); i++) node[i + n - 1] = v[i];
    for (int i = n - 2; i >= 0; i--) node[i] = calc(node[2 * i + 1], node[2 * i + 2]);
  }
  void update(int i, T v) {
    i += (n - 1); // 最下段のノードにアクセスする
    // 最下段のノードを更新したら、あとは親に上って更新していく
    node[i] = v;
    while (i > 0) {
      i = (i - 1) / 2; // 1つ親にする
      node[i] = calc(node[2 * i + 1], node[2 * i + 2]);
    }
  }
  // 要求区間 [a, b) 中の要素の最小値を答える
  // k := 自分がいるノードのインデックス、対象区間は [l, r) にあたる
  T query(int a, int b, int k = 0, int l = 0, int r = -1) {
    // 最初に呼び出されたときの対象区間は [0, n)
    if (r < 0) r = n;
    // 要求区間と対象区間が交わらない -> 適当に返す
    if (r <= a || b <= l) return init;
    // 要求区間が対象区間を完全に被覆 -> 対象区間を答えの計算に使う
    if (a <= l && r <= b) return node[k];
    // 要求区間が対象区間の一部を被覆 -> 子について探索を行う
    // 左側の子を vl ・ 右側の子を vr としている
    // 新しい対象区間は、現在の対象区間を半分に割ったもの
    T vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
    T vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
    return calc(vl, vr);
  }
};

void solve() {
  int n;
  cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];
  vl c(n + 1);
  vl m(n + 1);
  rep(i, n) c[i + 1] += c[i] + a[i];
  rep(i, n) m[i + 1] = max(m[i], c[i] + a[i]);
  dump(a);
  dump(c);
  dump(m);
  ll x = 0;
  ll ans = -INF;
  rep(i, n) {
    ll nx = x + m[i];
    maxs(ans, nx);
    x += c[i + 1];
    maxs(ans, x);
  }
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;
ll mod = 1000000007;

int main() {
    ll N,cnt=0,S = 0;
    cin >> N;
    vector<ll> A(N);
    for(int i=0; i<N; i++){
        cin >> A[i];
        S += A[i];
    }
    sort(A.begin(),A.end());
    for(int i=0; i<N-1; i++){
        S -= A[i];
        cnt += S - (A[i] * (N-i-1));
    }

    cout << cnt;
}


//bismillahir rahmanir rahim
//@uthor : mubin_akib

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair <int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i,a,b) for (int i = (b) - 1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a) - 1; i >= 0; i--)
#define REP(i, a, b) for(int i = (a); i <= (b); ++i)
#define trav(a,x) for(auto& a : x)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int mod = 1e9 + 7;
const char nl = '\n';
const int N  = 10005;

void solve() {
     string n;
     ll k;
     cin >> n >> k;
     while(k--){
         if(stoll(n) % 200 == 0){
             n = to_string(stoll(n) / 200);
         }
         else{
             n += "200";
         }
     }
     cout << n << nl;
}

int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
//    int t;
//    cin >> t;
//    while(t--){
//        solve();
//    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define endl "\n"
#define scan(a) scanf("%d", &a)
#define print(a) printf("%d\n", a)

int modadd(int a, int b,int MOD = mod){
    return((a%MOD)+(b%MOD)+MOD)%MOD;
}

int modsub(int a, int b,int MOD = mod){
    return((a%MOD) - (b%MOD) + MOD)%MOD;
}

void fast (void) __attribute__ ((constructor));
void fast (void) {
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void solve(){
   int N;
   cin>>N;
   vector<vector<int>> A(N,vector<int>(5));
    // vector A(N, array<int, 5>{});
   for(auto &a:A) for(int &i:a) cin>>i;
    int ok=0,ng=1000000001;

    auto check = [&](int x)->bool {
        set<int> s;
        for(auto &a:A){
            int bit=0;
            for(int &i:a){
                bit <<= 1;
                bit |= i>=x;
            }
            s.insert(bit);
        }
        for(int x:s) for(int y:s) for(int z:s){
            //if all 5 bits are set
            if((x|y|z)==31) return 1;
        }
        return 0;
    };

    while(abs(ok-ng)>1){
        int cen = (ok+ng)/2;
        (check(cen) ? ok : ng) = cen;
    }

    cout<<ok<<endl;

}

signed main (void)
{
    // int t;  cin>>t;
    // while(t--)
    {
        solve();
        cout<<"\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define tc int t;cin>>t;while(t--)
#define all(x) x.begin(),x.end()
#define f first
#define s second
#define pb push_back
#define pi pair<int,int>
#define pll pair<lli,lli>
#define vi vector<int>
#define vll vector<lli>
#define vpi vector<pair<int,int> >
#define vpll vector<pair<lli,lli> >
#define vvi vector<vector<int> >
#define vvll vector<vector<lli> >
#define vvpi vector<vector<pair<int,int> > >
#define vvpll vector<vector<pair<lli,lli> > >
#define inf 1000000000
#define maxn 1005
lli mod=998244353;

int main(){
    fastio;
    lli n;
    cin>>n;
    lli sm=0;
    for(int i=1;i<=n;i++){
        sm+=i;
        if(sm>=n)
        {
            cout<<i<<"\n";
            break;
        }
    }
	return 0;
}

#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/trie_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll 				long long int
#define ld				long double
#define mod             1000000007
#define inf             1e18
#define endl			"\n"
#define pb 				push_back
#define vi              vector<int>
#define vl              vector<ll>
#define vs				vector<string>
#define pii             pair<ll,ll>
#define ump				unordered_map
#define mp 				make_pair
#define pq_max          priority_queue<ll>
#define pq_min          priority_queue<ll,vi,greater<ll> >
#define all(n) 			n.begin(),n.end()
#define ff 				first
#define ss 				second
#define mid(l,r)        (l+(r-l)/2)
#define bitc(n) 		__builtin_popcount(n)
#define loop(i,a,b) 	for(int i=(a);i<=(b);i++)
#define looprev(i,a,b) 	for(int i=(a);i>=(b);i--)
#define iter(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define log(args...) 	{ string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define logarr(arr,a,b)	for(int z=(a);z<=(b);z++) cout<<(arr[z])<<" ";cout<<endl;
#define M 		1000000007
#define w(x)            int x; cin>>x; while(x--)
template <typename T> T gcd(T a, T b) {if (a % b) return gcd(b, a % b); return b;}
template <typename T> T lcm(T a, T b) {return (a * (b / gcd(a, b)));}
vs tokenizer(string str, char ch) {std::istringstream var((str)); vs v; string t; while (getline((var), t, (ch))) {v.pb(t);} return v;}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
//typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pbtrie;

void file_i_o()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

ll calc(ll k) {

	return k * (k + 1) / 2;
}

int main(int argc, char const *argv[]) {
	clock_t begin = clock();
	file_i_o();
	// Write your code here....
	ll n;
	cin >> n;

	loop(i, 1, n) {

		if (calc(i) >= n) {

			cout << i << endl;
			break;
		}

	}

#ifndef ONLINE_JUDGE
	clock_t end = clock();
	cout << "\n\nExecuted In: " << double(end - begin) / CLOCKS_PER_SEC * 1000 << " ms";
#endif
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
typedef pair<ll,ll> P;
#define mod 1000000007

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;}
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    ll n;
    string s,t;
    cin >> n >> s >> t;
    ll kazu_s=0,kazu_t=0;
    rep(i,n){
        if(s[i]=='0') kazu_s++;
        if(t[i]=='0') kazu_t++;
    }

    if(kazu_s!=kazu_t){
        cout << -1 << endl;
        return 0;
    }

    vector<ll> ss;
    vector<ll> tt;

    rep(i,n){
        if(s[i]=='0') ss.push_back(i);
        if(t[i]=='0') tt.push_back(i);
    }

    ll ans=0;

    rep(i,ss.size()){
        if(ss[i]!=tt[i]) ans++;
    }

    cout << ans << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sz size()
#define ll long long
#define all(_v) _v.begin(), _v.end()
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pvllvll pair <vector <ll>, vector <ll> >
#define ld long double
#define veci vector <int>
#define vecll vector <ll>

const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const double PI = 3.1415926535897932384626433832795;
const double eps = 1e-9;
const int MOD1 = 1e9 + 7;
const int MOD2 = 998244353;

void solve() {
    int a[4];
    cin >> a[0] >> a[1] >> a[2] >> a[3];
    int n = 4;
    bool ch = 0;
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            if(i == j) continue;
            for(int k = 0; k < n; ++k) {
                if(i == k || j == k) continue;
                for(int z = 0; z < n; ++z) {
                    if(i == z || k == z || j == z) continue;
                    if(a[k] == a[i] + a[j] + a[z] || a[i] + a[j] == a[k] + a[z]) {
                        ch = 1;
                    }
                }
            }
        }
    }
    if(!ch) cout << "No";
    else cout << "Yes";
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int T = 1;
    ///cin >> T;
    while(T--) solve(), cout << '\n';
    return 0;
}


#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<iomanip>
#include<cassert>
#include<functional>
typedef long long ll;

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);

	int n;
	int x;
	std::string s;

	std::cin >> n >> x >> s;

	for (int i = 0; i < n; i++){
		if (s.at(i) == 'o'){
			x += 1;
		}
		else{
			x -= 1;
			if (x < 0){
				x = 0;
			}
		}
	}

	std::cout << x << '\n';

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < b; ++i)

int debug = 0;

const int N = 2010, inf = 1e9;
int n, m, ans, dp[N][N];
vector <int> g[26][N];

main() {
    cin >> n >> m;
    rep(i, 1, n + 1) {
        rep(j, 1, n + 1) {
            if (i == j) {
                dp[i][j] = 0;
            } else {
                dp[i][j] = inf;
            }
        }
    }
    rep(i, 0, m) {
        int a, b, c; char cc;
        cin >> a >> b >> cc;
        c = cc - 'a';
        if (debug) {
            cerr << " edge: " <<  a << ' ' << b << ' ' << cc << endl;
        }
        g[c][a].push_back(b);
        g[c][b].push_back(a);
        if (a != b) dp[a][b] = dp[b][a] = 1;
    }
    set <array <int, 3>> d;
    rep(i, 1, n + 1) rep(j, i, n + 1) {
        d.insert({dp[i][j], i, j});
    }
    while (!d.empty()) {
        auto cur = *d.begin();
        d.erase(cur);
        int w = cur[0], a = cur[1], b = cur[2];
        if (debug) cerr << w << ' ' << a << ' ' << b << '\n';
        assert(a <= b);
        if (w == inf) break;
        rep(c, 0, 26) {
            for (int u : g[c][a]) for (int v : g[c][b]) {
                int uu = u, vv = v;
                if (uu > vv) swap(uu, vv);
                if (dp[uu][vv] > w + 2) {
                    d.erase({dp[uu][vv], uu, vv});
                    dp[uu][vv] = w + 2;
                    d.insert({dp[uu][vv], uu, vv});
                }
            }
        }
    }
    if (dp[1][n] == inf) {
        ans = -1;
    } else {
        ans = dp[1][n];
    }
    cout << ans << '\n';
}


#include <bits/stdc++.h>
using namespace std;

enum {
  NONE, BLUB, BLOCK
};

int main(int argc, char *argv[]) {
  cin.sync_with_stdio(false), cin.tie(nullptr);

  int H, W, N, M;
  cin >> H >> W >> N >> M;
  vector<vector<int>> grid(H, vector<int>(W, NONE));
  for (int i = 0; i < N; i++) {
    int x, y;
    cin >> x >> y;
    grid[x - 1][y - 1] = BLUB;
  }
  for (int i = 0; i < M; i++) {
    int x, y;
    cin >> x >> y;
    grid[x - 1][y - 1] = BLOCK;
  }
  vector<vector<bool>> visited(H, vector<bool>(W, false));
  for (int i = 0; i < H; i++) {
    int lastBlub = -1, lastBlock = -1;
    for (int j = 0; j < W; j++) {
      if (grid[i][j] == BLUB) {
        for (int k = lastBlock + 1; k <= j; k++) {
          visited[i][k] = true;
        }
        lastBlock = lastBlub = j;
      }
      if (grid[i][j] == BLOCK && lastBlub != -1) {
        for (int k = lastBlub + 1; k < j; k++) {
          visited[i][k] = true;
        }
      }
      if (grid[i][j] == BLOCK) {
        lastBlub = -1, lastBlock = j;
      }
    }
    if (lastBlub != -1) {
      for (int j = lastBlub + 1; j < W; j++) {
        visited[i][j] = true;
      }
    }
  }
  for (int j = 0; j < W; j++) {
    int lastBlub = -1, lastBlock = -1;
    for (int i = 0; i < H; i++) {
      if (grid[i][j] == BLUB) {
        for (int k = lastBlock + 1; k <= i; k++) {
          visited[k][j] = true;
        }
        lastBlub = lastBlock = i;
      }
      if (grid[i][j] == BLOCK && lastBlub != -1) {
        for (int k = lastBlub + 1; k < i; k++) {
          visited[k][j] = true;
        }
      }
      if (grid[i][j] == BLOCK) {
        lastBlub = -1, lastBlock = i;
      }
    }
    if (lastBlub != -1) {
      for (int i = lastBlub + 1; i < H; i++) {
        visited[i][j] = true;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      ans += visited[i][j];
    }
  }
  cout << ans << "\n";
}

#include<bits/stdc++.h>
using namespace std;

const long long INF = 1000000000;

typedef long long ll;

#define rep(i,n) for(int i=0; i<(n); ++i)

typedef pair<ll, ll> P;
typedef pair<string, int> Psi;

vector<int> G[2100];
ll visited[2100];
ll ct=0;
void dfs(int from){
	for(int j=0;j<G[from].size(); j++){
//		cout<<from<<":"<<G[from][j]<<endl;
		if(visited[G[from][j]] !=1){
			visited[from]=1;
			visited[G[from][j]]=1;
//			cout<<G[from][j]<<endl;
			ct++;
		dfs(G[from][j]);
		}
	}
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n,m;cin>>n>>m;

	for(int i=0; i<m; i++){
		int from,to;cin>>from>>to;

		G[from].push_back(to);
	}

	ll ans =0;
	for(int i=1; i<=n; i++){
		ct=1;
		for(int a=0; a<2005; a++){
				visited[a]=0;
		}
		dfs(i);
		ans +=ct;
	}
	cout<<ans<<endl;

}


#include <bits/stdc++.h>
using namespace std;

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int x, y;
	cin >> x >> y;
	int z = (x > y ? y - x : x - y) + 3;
	if (z > 0) cout << "Yes";
	else cout << "No";
}

#include<bits/stdc++.h>
using namespace std;

#define f(t) ll t; cin>>t; while(t--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define vec vector<ll>
#define vecpair vector<pair<ll,ll>>

using ll = long long;
using ld = long double;

const int N = 2e5 + 5;

int main(){
    IOS;
        int x,y;
        cin>>x>>y;
        if(abs(x-y)>=3){
            cout<<"No"<<endl;
        }
        else{
            cout<<"Yes"<<endl;
        }
}


#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define REP(i,x,n) for (int i=x; i<n; i++)
#define P pair<int,int>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
#define T tuple<int, int, int>
#define PP pair<P,P>
#define ALL(a) a.begin(), a.end()

int main(){
    int n;
    cin >> n;
    vector<PP> inputData;
    rep(i,n){
        int x, y, r;
        cin >> x >> y >> r;
        PP p = PP(P(r,i),P(x,y));
        inputData.push_back(p);
    }
    sort(ALL(inputData));
    // for (auto p : inputData){
    //     printf("%d %d %d %d\n", p.first.first, p.first.second, p.second.first, p.second.second);
    // }

    vector<PP> outputData(n);
    //広告は最低でも1の面積を持つので面積1で初期化
    rep(i,n){
        int index, x, y;
        index = inputData[i].first.second;
        x = inputData[i].second.first;
        y = inputData[i].second.second;
        outputData[index] = PP(P(x,y),P(x+1, y+1));
    }
    rep(i,n){
        int r, index, x, y;
        r = inputData[i].first.first;
        index = inputData[i].first.second;
        x = inputData[i].second.first;
        y = inputData[i].second.second;
        vector<P> divisors;
        //rについて約数列挙
        for (int i=1; i*i<=r; i++){
            if (r % i == 0){
                divisors.push_back(P(i,r/i));
            }
        }
        //交差検出
        int m = divisors.size();
        bool missFlag = true;
        rep(j,m){
            bool jadge = true;
            int vertical = divisors[j].first;
            int heng = divisors[j].second;
            //広告がはみ出すならbreak;
            if (x + vertical > 1e4) continue;
            if (y + heng > 1e4) continue;
            rep(k,(int)outputData.size()){
                if (k == index) continue;
                int a1 = outputData[k].first.first;
                int a2 = outputData[k].first.second;
                int b1 = outputData[k].second.first;
                int b2 = outputData[k].second.second;
                if (a1<=x && x<=b1 && a2<=y && y<=b2) jadge = false;
                if (a1<=x+vertical && x+vertical<=b1 && a2<=y+heng && y<=b2+heng) jadge = false;
                // if (x<=a1 && a1<=x+vertical && y<=a2 && a2<=y+heng) jadge = false;
                // if (x<=b1 && b1<=x+vertical && y<=b2 && b2<=y+heng) jadge = false;
                if (x<a1 && x+vertical>b1 && y>a2 && y+heng<b2) jadge = false;
                if (x<=b1 && b1<=x+vertical && y<=a2 && a2<=y+heng) jadge = false;
                if (x<=a1 && a1<=x+vertical && y<=b2 && b2<=y+heng) jadge = false;

            }
            //入れることができるなら広告を入れる．
            if (jadge){
                missFlag = false;
                outputData[index] = PP(P(x,y),P(x+vertical,y+heng));
                break;
            }
        }
        if (missFlag){
            r /= 2;
            if (r <= 1e2){
                continue;
            }
            PP p = PP(P(r,index),P(x,y));
            inputData.push_back(p);
            n++;
        }
    }
    for (auto p : outputData){
        printf("%d %d %d %d\n", p.first.first, p.first.second, p.second.first, p.second.second);
    }
}


// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define forn(i, s, n)  for(ll i=(ll)s; i<(ll)(n); i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define pll pair<long long int, long long int>
#define pii pair<int, int>
#define lld long double
#define F first
#define S second
#define PI 3.141592653589793238
#define prec(n) fixed<<setprecision(n)
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define itsval(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); itval(_it, args); }
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

void itval(istream_iterator<string> it) {}
template<typename T, typename... Args>
void itval(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    itval(++it, args...);
}
const ll MOD = 1e9 + 7;
template <typename T>
inline void print(T x) {cout << x << "\n";}
template <typename T>
inline void printvec(T x) {for (auto a : x)cout << a << ' '; cout << '\n';}
// -----------------------------------------------------------------------

struct custom {
    bool operator()(const pair<int, pii> &p1, const pair<int, pii> &p2)const {
        if (p1.F == p2.F)
            return p1.S.F > p2.S.F;
        return p1.F > p2.F;
    }
};

// Calculate a^b % MOD -------------------------------------------------
ll get_pow(ll a, ll b, ll M = MOD) {
    ll res = 1;
    while (b) {
        if (b & 1) res = (res * a) % M;
        a = (a * a) % M;
        b >>= 1;
    }
    return res;
}
// ---------------------------------------------------------------------
const ll N = 3e5 + 5, inf = 2e9;
std::vector<pii> adj[N];
int a[502][502], b[502][502], ind[502][502], dist[N];
void solve()
{
    int R, C;
    cin >> R >> C;
    forn(i, 1, R + 1)
    {
        forn(j, 1, C)
        {
            cin >> a[i][j];
        }
    }
    forn(i, 1, R)
    {
        forn(j, 1, C + 1)
        cin >> b[i][j];
    }
    forn(i, 1, R + 1)
    {
        forn(j, 1, C + 1) {
            ind[i][j] = j + C * i;
            dist[ind[i][j]] = inf;
        }
    }

    forn(i, 1, R + 1)
    {
        forn(j, 1, C + 1)
        {
            if (j < C)
            {
                adj[ind[i][j]].pb({a[i][j], ind[i][j + 1]});
            }
            if (j > 1)
            {
                adj[ind[i][j]].pb({a[i][j - 1], ind[i][j - 1]});
            }
            if (i < R)
            {
                adj[ind[i][j]].pb({b[i][j], ind[i + 1][j]});
            }
            forn(k, 1, i)
            {
                adj[ind[i][j]].pb({1 + k, ind[i - k][j]});
            }
        }
    }
    dist[ind[1][1]] = 0;
    set<pii>s;
    s.insert({0, ind[1][1]});
    while (!s.empty())
    {
        pll t = *s.begin();
        s.erase(s.begin());
        for (auto x : adj[t.S])
        {
            if (dist[x.S] > x.F + t.F)
            {
                s.erase({dist[x.S], x.S});
                dist[x.S] = x.F + t.F;
                s.insert({dist[x.S], x.S});
            }
        }
    }

    cout << dist[ind[R][C]] << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int test = 1;
    clock_t z = clock();
    //cin >> test;
    forn(tes, 0, test)
    {

        solve();
    }
    debug("Total Time:%.4f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
    return 0;
}

// #include <atcoder/all>
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int a, b;
    cin >> a >> b;
    int y = (a - b) / 2;
    int x = a - y;
    cout << x << " " << y << endl;

    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pp pop_back
#define mp make_pair
#define bb back
#define ff first
#define ss second

using namespace std;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int a, b;
    cin >> a >> b;
    cout << a*(a+1)/2*100*b + a*b*(b+1)/2 << '\n';
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define sortallr(x) sort(allr(x))
#define PI 3.1415926535897932384626
#define mod 1000000007

typedef pair<int, int>  pii;
typedef pair<ll, ll>  pll;
typedef vector<int>   vi;
typedef vector<ll>    vl;
typedef vector<pii>   vpii;
typedef vector<pll>   vpl;
typedef vector<vi>    vvi;
typedef vector<vl>    vvl;

void solve()
{
	int n,k;
	cin>>n>>k;

	int sum=0;

	for(int i=1;i<=n;i++)
		for(int j=1;j<=k;j++)
		{
			int no=i*100;
			no+=j;
			sum+=no;
		}
	cout<<sum;
}

int main(void)
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int t = 1;
	// cin >> t;
	while (t--)
	{
		solve();
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
    double n;
    cin >> n;
    double x=0;
    for (double i=1;i<n;i++){
        x+=n/i;
    }

    cout << fixed << setprecision(10) << x << endl;
}

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define F first
#define S second
#define all(v) (v).begin(),(v).end()
#define np next_permutation
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define vii vector<vi>
#define vb vector<bool>
#define pr pair<int,int>
#define vl vector<ll>
#define vs vector<string>
#define us unordered_map<int,int>
#define Mpq priority_queue<int>
#define mpq priority_queue<int,vi,greater<int>>
#define eb emplace_back
#define pr pair<int,int>
#define prl pair<ll,ll>
#define vp vector<pr>
#define vpl vector<prl>
#define mkp make_pair
#define ld long double
#define vii vector<vi>
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
#define ull unsigned long long
#define prr pair<ll,int>
#define inf (int)1e9+111

#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
using vi=vector<int>;

typedef tree<
pair <int,int>, null_type,
less<pair <int,int>>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;
ordered_set s;

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
template<class T> using pqg = priority_queue<T,vector<T>,greater<T>>;

double epsilon=(double)1e-9;

const int N=3e5+123;
ll n,m,k,x,y,t,sum,prev_e,tot,val,pos=1;
ll last_room,rooms;
string pattern,word;
const int Max=(int)1e5;

int ver[4]={1,-1,0,0},hor[4]={0,0,1,-1};
string MV="DURL",moves;

const ll MX=(ll)1e16+123;

template<int N> struct Dij{
   ll d[N];
   vector<pair<ll,prl>> g[N];
   pqg<prl> q;

   void addEdge(ll a,ll b,ll c,ll d){
      g[a].pb(make_pair(b,make_pair(c,d)));
      g[b].pb(make_pair(a,make_pair(c,d)));
   }

   void algo(int s){
      fill_n(d,N,MX);
      q=pqg<prl>();
      q.push({d[s]=0,s});

      while(!q.empty()){
         auto x=q.top();
         q.pop();
         if(d[x.S]<x.F) continue;
         for(auto &y:g[x.S]){
            ll distance=ceil((double)x.F/(double)y.S.S)*y.S.S+y.S.F;
            if(distance<d[y.F]){
               q.push({d[y.F]=distance,y.F});
            }
         }
      }
   }
};

Dij<N> D;

void solve(){
   int n;
   double ans=0;
   cin>>n;
   lps(i,1,n){
     ans+=(double)n/(double)(n-i);
   }
   cout<<setprecision(15)<<fixed;
   cout<<ans<<"\n";
}

int main(){
   ios_base::sync_with_stdio(0);
   cin.tie(nullptr);
   solve();
   return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long

int32_t main(){

    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int t;
    cin>>t;

    while(t--){
        int n;
        cin>>n;

        map<int,int> mp;
        for(int i=0;i<n;i++){
            int x;
            cin>>x;
            mp[x]++;
        }

        if(n&1){
            cout<<"Second"<<"\n";
            continue;
        }

        bool all_even = true;
        for(pair<const int,int> &p : mp){
            if(p.second&1){
                all_even = false;
                break;
            }
        }

        if(all_even){
            cout<<"Second"<<"\n";
        }
        else {
            cout<<"First"<<"\n";
        }
    }

    return 0;
}

#include <bits/stdc++.h>
#define For(i, l, r) for (register int i = l, _r = r; i <= _r; ++i)
#define Ford(i, l, r) for (register int i = r, _l = l; i >= _l; --i)
using namespace std;
typedef long long ll;
#define pii pair<int, int>
#define mk make_pair
const int N = 1e5 + 20;
const int mod = 1e9 + 7;
int T, n, a[N];
ll sum, tot;

inline int read()
{
    int x = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9')
    {
        if (ch == '-')
            f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9')
    {
        x = (x << 3) + (x << 1) + ch - '0';
        ch = getchar();
    }
    return x * f;
}

int main()
{
    int t = read();
    while (t--)
    {
        sum = tot = 0;
        n = read();
        For(i, 1, n)
            a[i] = read();
        sort(a + 1, a + 1 + n);
        if (n & 1)
        {
            For(i, 2, n) i & 1 ? sum += a[i] : tot += a[i];
            sum += a[1];
            puts(sum ^ tot ? "Second" : "First");
        }
        else
        {
            For(i, 1, n) i & 1 ? sum += a[i] : tot += a[i];
            puts(sum ^ tot ? "First" : "Second");
        }
    }
    return 0;
}


#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2")
#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl "\n"
#define forn(i,n) for(int i=0;i<n;i++)
#define fore(i,l,r) for(int i=int(l);i<=int(r);i++)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout<<(x)<<endl
#define watch2(x,y) cout<<(x)<<" "<<(y)<<endl
#define watch3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);
#define uid(a,b) uniform_int_distribution<int>(a,b)(rng)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

const int INF = 9e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 5;

int i, j, n, pref[N];
vpii g[N];

void dfs(int v, int par) {
    for (auto &p : g[v]) {
        int u = p.f, w = p.s;
        if (u != par) {
            pref[u] = pref[v] ^ w;
            dfs(u, v);
        }
    }
}

void burn() {
    cin >> n;
    for (i = 1; i <= n; i++) {
        int u, v, w;
        cin >> u >> v >> w;
        g[u].pb({v, w});
        g[v].pb({u, w});
    }
    pref[1] = 0;
    dfs(1, 0);
    int ans = 0;
    for (j = 0; j < 62; j++) {
        int odd = 0, even = 0;
        for (i = 1; i <= n; i++) {
            if (pref[i] >> j & 1) {
                odd++;
            } else {
                even++;
            }
        }
        int pairs = (odd * even) % mod, contri = (1LL << j) % mod;
        ans += (pairs * contri) % mod;
        ans %= mod;
    }
    cout << ans << endl;
}

signed main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fastio;
    int t = 1;
    // cin >> t;
    while (t--) {
        burn();
    }
    return 0;
}

#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <numeric>
#include <chrono>
#include <random>
#include <bitset>
#include <tuple>
#include <queue>
#include <map>
#include <unordered_map>
#include <cstring>
#include <cassert>
#include <climits>
#include <complex>
#include <math.h>
using namespace std;

const int N = 2e5 + 10, mod =998244353;

int dp[N][2], arr[N], n;

int solve(int i, bool j) {
    if(i == n) return 0;
    if(dp[i][j] != -1) return dp[i][j];
    int ret = 0;

    if(!j) {
        ret = solve(i + 1, 0);
        if(i != n - 1) ret = (ret + 1ll * arr[i] * solve(i + 1, 1) % mod) % mod;
        ret = (ret + 1ll * arr[i] * arr[i] % mod) % mod;
    }
    else {
        ret = arr[i];
        if(i != n - 1) ret = (ret + 2ll * solve(i + 1, j) % mod) % mod;
    }

    return dp[i][j] = ret;
}

int main() {
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int tc = 1;
    for(int cn = 1; cn <= tc; cn++) {
         scanf("%d", &n);
        for(int i = 0; i < n; i++)
            scanf("%d", &arr[i]);

        sort(arr, arr + n);
        memset(dp, -1, sizeof(dp));
        printf("%d\n", solve(0, 0));
    }
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <random>
#include <stdlib.h>
#include <time.h>
#include <utility>
#include <algorithm>
#include <unistd.h>
using namespace std;

int main(){
  srand((unsigned)time(NULL));
  time_t start = time(NULL);
  int si,sj,x,y,now,cnt,num=0;
  string ans="",A="";
  cin>>si>>sj;
  vector<vector<int>> t(50,vector<int>(50));
  vector<vector<int>> p(50,vector<int>(50));
  vector<int> gone(2500);
  for(int i=0;i<50;i++)for(int j=0;j<50;j++)cin>>t.at(i).at(j);
  for(int i=0;i<50;i++)for(int j=0;j<50;j++){
    cin>>p.at(i).at(j);
  }
  while(time(NULL)-start<1.9){
    x=si;//初期化
    y=sj;
    ans="";
    cnt=p.at(x).at(y);
    fill(gone.begin(),gone.end(),0);
    while(1){
      now=t.at(x).at(y);
      gone.at(now)=1;
      vector<pair<pair<int,char>,pair<int,int>>> tmp;
      if(x!=0 && gone.at(t.at(x-1).at(y))==0){
        tmp.push_back({{p.at(x-1).at(y),'U'},{x-1,y}});
      }
      if(x!=49 && gone.at(t.at(x+1).at(y))==0){
        tmp.push_back({{p.at(x+1).at(y),'D',},{x+1,y}});
      }
      if(y!=0 && gone.at(t.at(x).at(y-1))==0){
        tmp.push_back({{p.at(x).at(y-1),'L'},{x,y-1}});
      }
      if(y!=49 && gone.at(t.at(x).at(y+1))==0){
        tmp.push_back({{p.at(x).at(y+1),'R'},{x,y+1}});
      }
      if(tmp.size()==0){
        if(cnt>num){
          num=cnt;
          A=ans;
        }
        break;
      }
      int len=tmp.size();
      int go;
      if(len==1){
        go=0;
      }else if(len==2){
        sort(tmp.begin(),tmp.end());
        int q=rand()%10;
        if(q<2)go=0;
        else go=1;
      }else if(len==3){
        sort(tmp.begin(),tmp.end());
        int q=rand()%10;
        if(q<1)go=0;
        else if(q<3)go=1;
        else go=2;
      }else{
        sort(tmp.begin(),tmp.end());
        //最初だけありえる
        go=rand()%4;
      }
      if(go>=len){
        sleep(2);
      }
      pair<pair<int,char>,pair<int,int>> u=tmp.at(go);
      x=u.second.first;
      y=u.second.second;
      ans+=u.first.second;
      cnt+=u.first.first;
    }
    //cout<<cnt<<endl;
  }
  cout<<A<<endl;
  //cerr<<time(NULL)-start<<endl;
  return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define DIM 20
#define DIMMASK 270007

//#define ll long long

long long a[DIM],d[DIMMASK];

bool isbit(int mask, int bit) {
    return (mask & (1 << (bit-1))) != 0;
}

int removebit(int mask, int b) {
    return mask & ~(1 << (b-1));
}

vector< pair<int,int> > g[DIM];
int n,q,x,y,z;

int main()
{
    //freopen("input.txt","r",stdin);

    int n,maxmask,prevmask,currres,currcount;

    cin >> n >> q;
    for(int i=1; i<=q; i++) {
        cin >> x >> y >> z;
        g[x].push_back({y,z});
    }

    d[0] = 1;
    maxmask = (1 << n) - 1;
    for(int m = 0; m <= maxmask; m++) {
        for(int last = 1; last <= n; last++) {
            if(!isbit(m,last)) continue;
            prevmask = removebit(m,last);
            d[m] += d[prevmask];
        }

        //cout <<"BEFORE "<< m<<" "<<d[m]<<endl;

        x = __builtin_popcount(m);
        for(auto [y,z] : g[x]) {
            //cout <<"YZ="<<y<<" "<<z<<endl;
            int tmpmask = m & ((1<<y)-1);
            //cout <<"PC="<<__builtin_popcount(tmpmask)<<endl;
            if(__builtin_popcount(tmpmask)>z) d[m] = 0;
        }
        //cout <<"AFTER "<< m<<" "<<d[m]<<endl;

    }

    cout << d[maxmask] << endl;
    //for(int i=0; i<=maxmask; i++) cout << i<<" "<<d[i]<<endl;

    return 0;
}


#include<bits/stdc++.h>
#define PI 3.141592653589793238462
#define eps 1e-10
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<db,db> pdd;
int x[1005],y[1005];
int main(){
    string s,t;cin>>s>>t;
    int ns=0,nt=0;
    for(int i=0;i<s.length();i++){
        ns+=(s[i]-'0');
        nt+=(t[i]-'0');
    }
    cout<<max(ns,nt)<<endl;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

template <class T>
using idx_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long
#define ull unsigned long long
#define arr array
#define vt vector
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define all(v) (v).begin(), (v).end()
#define pi acosl(-1)

//ofstream out("debug.txt");

const int MxN = 1e5, md = 1e9 + 7;

int s(int a)
{
	int c = 0;
	while (a)
	{
		c += a % 10;
		a /= 10;
	}
	return c;
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int a, b, c, d;
	cin >> a >> b;
	c = s(a), d = s(b);
	cout << (c >= d ? c : d) << '\n';
}


#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 2e5 + 101;
int a[N], b[N], n;

signed main()
{
	scanf("%lld",&n);
	for(int i = 1;i <= n; i++) scanf("%lld",&a[i]);
	for(int i = 1;i <= n; i++) scanf("%lld",&b[i]);
	int now1 = a[1],now2 = b[1], nowmax = now1 * now2;
	printf("%lld\n",nowmax);
	for(int i = 2;i <= n; i++)
	{
		now1 = max(now1,a[i]);
		nowmax = max(nowmax,b[i] * now1);
		printf("%lld\n",nowmax);
	}
}

//Let's join Kaede Takagaki Fan Club !!
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#define int long long
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define a first
#define b second
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define all(x) x.begin(),x.end()
#define si(x) int(x.size())

#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b;return true;}else return false;}
template<class t,class u> bool chmin(t&a,u b){if(b<a){a=b;return true;}else return false;}

template<class t> using vc=vector<t>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.fi<<","<<p.sc<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

template<class T>
void g(T &a){
	cin >> a;
}
template<class T>
void o(const T &a,bool space=false){
	cout << a << (space?' ':'\n');
}
//ios::sync_with_stdio(false);
const ll mod = 1000000007;//998244353
//mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
template<class T>
void add(T&a,T b){
	a+=b;
	if(a >= mod) a-=mod;
}
ll modpow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1) res=res*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return res;
}
int n;
ll a[200005], b[200005];
void solve(){
	cin >> n;
	repn(i, n) cin >> a[i];
	ll mx = 0;
	repn(i, n){
		cin >> b[i];
		chmax(mx, a[i]);
		b[i] *= mx;
	}
	repn(i, n){
		chmax(b[i], b[i-1]);
		cout << b[i] << '\n';
	}
}
signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
	int t; t = 1; // cin >> t;
	while(t--) solve();
}


#define _GLIBCXX_DEBUG
// #include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <unordered_set>
#include <utility>
#include <tuple>
using namespace std;

using ll = int64_t;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)

const ll INF = 1ll << 60; // 十分大きい値とする (ここでは 2^60)
const ll MOD = 1000000007;
const double PI = acos(-1);

template<class T> void chmin(T &a, T b) {
  if (a > b) a = b;
}

template<class T> void chmax(T &a, T b) {
  if (a < b) a = b;
}

int main() {
  ll N;
  cin >> N;

  double x0, y0;
  cin >> x0 >> y0;

  double xn2, yn2; // x_{N/2}, y_{N/2}
  cin >> xn2 >> yn2;

  // 2点 p_{0}, p_{N/2} の距離
  double dist;
  dist = sqrt((x0 - xn2)*(x0 - xn2) + (y0 - yn2)*(y0 - yn2));

  double theta = PI*(N - 2)/N; // 正N角形の頂点の角度
  double r; // 正N角形の1辺の長さ
  if ((N/2)%2 == 0) {
    double sum_cos = 0;
    double a = theta/2.0;
    rep(i, N/4) {
      sum_cos += 2.0*cos(a);
      a = theta - PI + a;
    }
    r = dist/sum_cos;
  }
  else {
    double sum_cos = 1.0;
    double a = theta/2.0;
    rep(i, (N-2)/4) {
      sum_cos += 2.0*cos(a);
      a = theta - PI + a;
    }
    r = dist/sum_cos;
  }

  // p_{0} から p_{N/2} へのベクトルを長さ r に規格化したもの
  double vx, vy;
  vx = r*(xn2 - x0)/dist;
  vy = r*(yn2 - y0)/dist;

  // p_{0} から p_{1} へのベクトル
  double wx, wy;
  wx =  cos(theta/2.0)*vx + sin(theta/2.0)*vy;
  wy = -sin(theta/2.0)*vx + cos(theta/2.0)*vy;

  cout << fixed << setprecision(11);
  cout << x0 + wx << " " << y0 + wy << endl;
}

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define forin(in ,n) for(ll i=0; i<n; i++) cin>>in[i]
#define forout(out) for(ll i=0; i<(ll)out.size(); i++) cout<<out[i]<<endl
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep_up(i, a, n) for (ll i = a; i < n; ++i)
#define rep_down(i, a, n) for (ll i = a; i >= n; --i)
#define P pair<ll, ll>

#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define vvvll vector<vector<vector<ll>>>
#define vvll vector<vector<ll>>
#define vll vector<ll>
#define pqll priority_queue<ll>
#define pqllg priority_queue<ll, vector<ll>, greater<ll>>

constexpr ll INF = (1ll << 60);
constexpr ll mod = 1000000007;
//constexpr ll mod = 998244353;
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
void pt(T val) {
    cout << val << "\n";
}
template <typename T>
void pt_vll(vector<T> &v) {
    ll vs = v.size();
    rep(i, vs) {
        cout << v[i];

        if (i == vs - 1)
            cout << "\n";
        else
            cout << " ";
    }
}
ll mypow(ll a, ll n) {
    ll ret = 1;
    if(n==0) return 1;
    if(a==0) return 0;
    rep(i, n) {
        if (ret > (ll)(1e18 + 10) / a) return -1;
        ret *= a;
    }
    return ret;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

//自分以外の約数の和
ll enum_sum(ll n){
    ll ret=0;
    if(n==1) return 0;
    for(ll i = 1 ; i*i <= n ; ++i){
        if(n%i == 0){
            ret+=i;
            if(i != 1 && i*i != n){
                ret+=(n/i);
            }
        }
    }
    return ret;
}

int main() {
    ll r,c,n,m,t,k=0,cnt=INF,ans=0;
    string s;
    cin>>t;
    rep(bit,t){
        cin>>n>>s>>s>>s;
        rep(i,n){
            cout<<0;
        }
        rep(i,n){
            cout<<1;
        }
        cout<<0<<endl;
    }
}


/**
*!! God will direct your steps !!
* @Author  : Ekansh Saxena (ekansh9927)
* @DateTime: 19-12-2020  17:59:21
*
**/
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define pll pair<long long,long long>
#define B begin()
#define E end()
#define usi unordered_set<int>
#define usll unordered_set<long long>
#define uslli unordered_set<long long int>
#define umll unordered_map<long long,long long>
#define umlli unordered_map<long long int,long long int>
#define umstoll unordered_map<string,long long>
#define umchtoll unordered_map<char,long long>
#define vi vector<int>
#define vll vector<long long>
#define vlli vector<long long int>
#define vpll vector<pair<long long,long long>>
#define sortall(arr) sort(arr.begin(),arr.end())
#define modadd(a,b) (a%mod + b%mod)%mod
#define modsub(a,b) (a%mod - b%mod)%mod
#define modmul(a,b) (a%mod * b%mod)%mod
#define REP(n) for(int i=0;i<n;i++)
#define FOR(i,l,r,in) for(i=l;i<r;i+=in)
#define FILL(n,arr) for(int i=0;i<n;i++){ll x;cin>>x;arr.pb(x);}
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef long long ll;
typedef long long int lli;
//___________________________________POWER____________________________________________
ll power(ll x, ll y, ll p){
ll res = 1;
x = x % p;
if (x == 0) return 0;
while (y > 0)
{
if (y & 1)
res = (res*x) % p;
y = y>>1;
x = (x*x) % p;
}
return res;
}
//_______________________________END-OF-POWER__________________________________________

void solve(){
ll n,m;
cin>>n>>m;
cout<<n/m<<endl;

}

int main(){
    FIO;
    ll t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

#include <math.h>
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <tuple>
#include <vector>
#include <cmath>
#include<set>
#include <sstream>
#include <bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a)  (a).begin(),(a).end()//配列を全部参照

using namespace std;
using ll = long long int;
using Graph = vector<vector<int>>; // グラフ型
//cin.tie(nullptr); /*高速で入力可能*/
//vector<vector<int>> hako(n, vector<int>(2));
//sort(hako.begin(), hako.end(), [](const vector<int>& alpha, const vector<int>& beta) {return alpha[0] < beta[0]; });

int main() {
	cin.tie(nullptr);
	ll n,h,w;
	ll ans = 1;
	cin >> h >> w;
	vector<vector<char>> hako(h, vector<char>(w));
	vector<bool> R(h + w-1), B(h + w-1);
	rep(i, h)rep(j, w) cin >> hako[i][j];
	rep(i, h)rep(j, w) {
		if (hako[i][j] == 'R') R[i + j] = true;
		if (hako[i][j] == 'B') B[i + j] = true;
	}

	rep(i, h + w-1) {
		if (R[i] && B[i]) ans = 0;
		if (!R[i] && !B[i]) ans = ans * 2 % 998244353;
	}

	cout << ans << endl;
	return 0;
}


#pragma GCC optimize("O2")

#include <bits/stdc++.h>

#ifdef DEBUG
#include "debug.hpp"
#endif

using namespace std;

#define all(c)              (c).begin(), (c).end()
#define rall(c)             (c).rbegin(), (c).rend()
#define traverse(c, it)     for(auto it = (c).begin(); it != (c).end(); ++it)
#define rep(i, N)           for(int i = 0; i < (N); ++i)
#define rrep(i, N)          for(int i = (N) - 1; i >= 0; --i)
#define rep1(i, N)          for(int i = 1; i <= (N); ++i)
#define rep2(i, s, e)       for(int i = (s); i <= (e); ++i)
#define rep3(i, s, e, d)    for(int i = (s); (d) >= 0 ? i <= (e) : i >= (e); i += (d))

#ifdef DEBUG
#define debug(x...)         { \
                            ++dbg::depth; \
                            string dbg_vals = dbg::to_string(x); \
                            --dbg::depth; \
                            dbg::fprint(__func__, __LINE__, #x, dbg_vals); \
                            }

#define light_debug(x)      { \
                            dbg::light = true; \
                            dbg::dout << __func__ << ":" << __LINE__; \
                            dbg::dout << "  " << #x << " = " << x << endl; \
                            dbg::light = false; \
                            }
#else
#define debug(x...)         42
#define light_debug(x)      42
#endif

using ll = long long;

template<typename T>
inline T& ckmin(T& a, T b) { return a = a > b ? b : a; }

template<typename T>
inline T& ckmax(T& a, T b) { return a = a < b ? b : a; }

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    #ifdef DEBUG
    freopen("debug", "w", stderr);
    #endif

    int N, M; cin >> N >> M;
    vector<vector<bool>> E(N, vector<bool>(N));
    rep(_, M) {
        int a, b; cin >> a >> b; --a, --b;
        E[a][b] = E[b][a] = true;
    }

    vector<bool> ch(1 << N, true);
    rep(m, 1 << N) {
        rep(i, N) rep2(j, i + 1, N - 1)
            if((m & (1 << i)) && (m & (1 << j)) && !E[i][j])
                ch[m] = false;
    }

    vector<int> dp(1 << N, N); dp[0] = 0;
    rep(m, 1 << N) {
        for(int i{m}; i; i = (i - 1) & m)
            if((i & m) == i && ch[i]) ckmin(dp[m], 1 + dp[m ^ i]);
    }

    cout << dp.back() << '\n';

    #ifdef DEBUG
    dbg::dout << "\nExecution time: " << clock() * 1000 / CLOCKS_PER_SEC  << "ms" << endl;
    #endif

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define vec vector
#define PB push_back

#define MP make_pair
#define MT make_tuple
#define F first
#define S second

using ll = long long int; // watch out for overflows in your code
using pii = pair<int,int>;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void debug() { cout << "\n"; };
template <typename T, typename... Targs>
void debug(T t, Targs... args) {
    cout << t << " ";
    debug(args...);
}

template <typename T1, typename T2>
inline ostream& operator << (ostream& os, const pair<T1,T2>& p) {
    return os << "(" << p.F << ", " << p.S << ")";
}

template <typename T>
inline ostream& operator << (ostream& os, const vec<T>& v) {
    for(auto& t : v) {
        os << t << " ";
    }
    return os;
}

template <typename T>
inline ostream& operator << (ostream& os, const vec<vec<T>>& m) {
    for(auto& v : m) {
        for(auto& t : v) {
            os << t << " ";
        }
        os << "\n";
    }
    return os;
}

template <typename T>
inline ostream& operator << (ostream& os, const set<T>& v) {
    for(auto& t : v) {
        os << t << " ";
    }
    return os;
}

template <typename K, typename V>
inline ostream& operator << (ostream& os, const map<K,V>& m) {
    for(auto& p : m) {
        os << p.F << " -> " << p.S << "\n";
    }
    return os;
}

const int INF = 1e9;
int N, M;
vec<vec<int>> adj;

struct Solution {
    int lso(int x) {
        return x & (-x);
    }

    bool complete(int mask) {
        int m = mask;
        while(m) {
            int bit_u = lso(m);
            int u = __builtin_ctz(m) + 1;
            int new_mask = bit_u;
            for(int v : adj[u]) {
                new_mask |= (1 << (v-1));
            }
            if((new_mask & mask) != mask) {
                return false;
            }
            m -= bit_u;
            //debug(mask, new_mask);
        }
        return true;
    }

    int S;
    vec<int> dp;
    int ans;

    Solution() : S((1 << N) - 1), dp(S+1, -1) {
        compute();
        ans = dp[S];
    }

    void compute() {
        dfs(S);
    }

    int dfs(int mask) {
        //debug("dfs_in", mask);
        if(mask == 0) {
            return 0;
        }
        int& ans = dp[mask];
        if(ans != -1) {
            //debug("dfs_out_0", mask, ans);
            return ans;
        }
        if(complete(mask)) {
            //debug("dfs_out_1", mask, ans);
            ans = 1;
        }
        else {
            ans = INF;
            for(int m = mask; m > 0; m = ((m-1) & mask)) {
                //debug("dfs_mid", m, mask^m);
                if(m != 0 && (mask ^ m) != 0) {
                    ans = min(ans, dfs(m) + dfs(mask ^ m));
                }
            }
        }
        //debug("dfs_out_2", mask, ans);
        return ans;
    }

};

////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> N >> M;
    adj.assign(N+1, vec<int>());
    for(int i = 1; i <= M; ++i) {
        int a, b;
        cin >> a >> b;
        adj[a].PB(b);
        adj[b].PB(a);
    }

    Solution sol;
    /*
    cout << sol.check_complete(0b111);
    cout << sol.check_complete(0b101);
    cout << sol.check_complete(0b100);
    cout << "\n";
    */
    cout << sol.ans << "\n";
}


#pragma GCC optimize("O2")

#include <bits/stdc++.h>

namespace IN {
#define BUF_SIZE 1 << 17
static char buf[BUF_SIZE], *fs = buf, *ft = buf;
inline int nc() { return fs == ft && (ft = (fs = buf) + fread(buf, 1, BUF_SIZE, stdin), fs == ft) ? EOF : *fs++; }
template <typename T>
inline int rn(T &x) {
    x = 0;
    int f = 0;
    char ch = nc();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = 1;
        ch = nc();
        if (ch == EOF) return EOF;
    }
    while (ch >= '0' && ch <= '9') {
        x = x * 10 + ch - 48;
        ch = nc();
    }
    x = f ? -x : x;
    return 0;
}
template <typename T>
inline int read(T &x) {
    return rn(x);
}
template <typename T, typename... Args>
inline int read(T &x, Args &...args) {
    rn(x);
    return read(args...);
}
#undef BUF_SIZE
}  // namespace IN

namespace OUT {
template <typename T>
inline void print(std::string, T x) {
    std::cout << x << std::endl;
}
template <typename T, typename... Args>
inline void print(std::string sep, T x, Args... args) {
    std::cout << x << sep;
    print(sep, args...);
}
}  // namespace OUT
using namespace IN;
using namespace OUT;
using namespace std;

#define INF 0x3f3f3f3f
#define LL long long
#define PLL pair<LL, LL>
#define PII pair<int, int>
#define MP make_pair
#define FI first
#define SE second
#define PB push_back
#define ALL(A) A.begin(), A.end()
#define BPQ(type, name) priority_queue<type> name
#define SPQ(type, name) priority_queue<type, vector<type>, greater<type>> name
#define REP(i, n) for (LL i = 0; i < (LL)n; ++i)
#define REP1(i, n) for (LL i = 1; i <= (LL)n; ++i)
#define REP_R(i, a, b) for (LL i = (LL)a; i < (LL)b; ++i)
#define REP_RR(i, a, b) for (LL i = (LL)a; i >= (LL)b; --i)
#define SETVAL(array, val) memset(array, val, sizeof(array))
// Debug
#define DISP(arr, n)                 \
    REP(i, n) cout << arr[i] << ' '; \
    cout << endl;
#define DISP1(arr, n)                 \
    REP1(i, n) cout << arr[i] << ' '; \
    cout << endl;
#define DISP_T(arr, n, m)                   \
    REP(i, n) {                             \
        REP(j, m) cout << arr[i][j] << ' '; \
        cout << endl;                       \
    }
#define DISP_T1(arr, n, m)                   \
    REP1(i, n) {                             \
        REP1(j, m) cout << arr[i][j] << ' '; \
        cout << endl;                        \
    }
#define SIZE 200010
LL t[SIZE];
int n;
int main() {
    read(n);
    LL tak = 0;
    REP(i, n) {
        LL a, b;
        read(a, b);
        t[i] = 2 * a + b;
        tak -= a;
    }
    sort(t, t + n, greater<LL>());
    int p = 0;
    while (tak <= 0) tak += t[p++];
    cout << p << endl;
    return 0;
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

#define stp(var, init, end) for (auto var = init; var < end; ++var)
#define ll long long

int main(void)
{
    int n, cou = 0;
    cin >> n;
    ll dif = 0, a, b;
    vector<ll> get(n);
    stp(i, 0, n)
    {
        cin >> a >> b;
        dif += a;
        get[i] = 2 * a + b;
    }
    sort(get.begin(), get.end(), [](ll a, ll b) { return a > b; });
    for (int x = 0; dif >= 0; ++x)
    {
        dif -= get[x];
        ++cou;
    }
    cout << cou;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using Int = long long;
#define PUTS(x) std::cout << (x) << endl;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)

vector<Int> IntsIn(int n) {
    auto v = vector<Int>(0);
    for (int i = 0; i < n; i++) {
        Int a;
        cin >> a;
        v.push_back(a);
    }
    return v;
}

int main() {
    Int n, m;
    cin >> n >> m;
    auto a = IntsIn(n);
    auto b = IntsIn(n);
    auto g = vector<vector<Int>>(n, vector<Int>());

    rep(i, m) {
        Int c, d;
        cin >> c >> d;
        c--;
        d--;
        g[c].push_back(d);
        g[d].push_back(c);
    }

    auto components = vector<set<Int>>();
    auto visited = vector<bool>(n, false);

    rep(i, n) {
        auto component = set<Int>();
        function<void(Int)> dfs = [&](Int index) {
            if (visited[index]) return;
            visited[index] = true;
            component.insert(index);
            for (auto nextIndex : g[index]) {
                dfs(nextIndex);
            }
        };
        dfs(i);
        if (component.size() > 0) {
            components.push_back(component);
        }
    }

    for (auto s : components) {
        Int A = 0;
        Int B = 0;
        for (auto i : s) {
            A += a[i];
            B += b[i];
        }
        if (A != B) {
            PUTS("No");
            exit(0);
        }
    }
    PUTS("Yes");
}

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll H,W;
ll A[505][505];
ll B[505][505];
struct edge{ll to,cost;};
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using PPP=pair<ll,PP>;
using Graph=vector<vector<edge>>;
static const ll INF=1000000000000000;
ll d[2][505][505];
void dijkstra(ll sx,ll sy){
  for(ll k=0;k<2;k++)
    for(ll i=0;i<H;i++)
      for(ll j=0;j<W;j++)d[k][i][j]=INF;d[0][sx][sy]=0;
    priority_queue<PPP,vector<PPP>,greater<PPP>>que;
    que.push(PPP(0,PP(0,P(sx,sy))));
    while(!que.empty()){
        PPP p=que.top();que.pop();
        ll D=p.first;ll t=p.second.first;ll X=p.second.second.first;
      ll Y=p.second.second.second;
        if(d[t][X][Y]<D)continue;
        if(Y+1<W){
        if(d[t][X][Y]+A[X][Y]<d[0][X][Y+1]){
  d[0][X][Y+1]=d[t][X][Y]+A[X][Y];
    PPP p;p.first=d[0][X][Y+1];p.second.first=0;p.second.second.first=X;
     p.second.second.second=Y+1;que.push(p);
        }
        }
      if(0<=Y-1){
      if(d[t][X][Y]+A[X][Y-1]<d[0][X][Y-1]){
  d[0][X][Y-1]=d[t][X][Y]+A[X][Y-1];
    PPP p;p.first=d[0][X][Y-1];p.second.first=0;p.second.second.first=X;
     p.second.second.second=Y-1;que.push(p);
        }

      }
      if(X+1<H){
      if(d[t][X][Y]+B[X][Y]<d[0][X+1][Y]){
  d[0][X+1][Y]=d[t][X][Y]+B[X][Y];
    PPP p;p.first=d[0][X+1][Y];p.second.first=0;p.second.second.first=X+1;
     p.second.second.second=Y;que.push(p);
        }

      }
      if(0<=H-1){
      if(d[t][X][Y]+2-t<d[1][X-1][Y]){
  d[1][X-1][Y]=d[t][X][Y]+2-t;
    PPP p;p.first=d[1][X-1][Y];p.second.first=1;p.second.second.first=X-1;
     p.second.second.second=Y;que.push(p);
        }

      }
    }
}
int main(){
  cin>>H>>W;Graph G(H*W);
  for(ll i=0;i<H;i++)
    for(ll j=0;j<W-1;j++)cin>>A[i][j];
  for(ll i=0;i<H-1;i++)
    for(ll j=0;j<W;j++)cin>>B[i][j];
  dijkstra(0,0);
 cout<<d[0][H-1][W-1]<<endl;
  return 0;
}


#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

using graph=vector<vector<int>>;

void add_directed_edge(graph& G,int u,int v){
	G[u].emplace_back(v);
}

const long long INF=1LL<<61;

int main(){
	int n,m; scanf("%d%d",&n,&m);
	vector<lint> a(n);
	rep(i,n) scanf("%lld",&a[i]);

	graph G(n);
	rep(i,m){
		int u,v; scanf("%d%d",&u,&v); u--; v--;
		add_directed_edge(G,u,v);
	}

	vector<lint> dp(n,INF);
	rep(u,n) for(int v:G[u]) {
		dp[v]=min({dp[v],dp[u],a[u]});
	}

	lint ans=-INF;
	rep(u,n) ans=max(ans,a[u]-dp[u]);
	printf("%lld\n",ans);

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int N;

int main(){
  cin >> N;

  if (N * 108 / 100 < 206)puts("Yay!");
  else if (N * 108 / 100 == 206)puts("so-so");
  else puts(":(");

  return 0;
}

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
using namespace std;
using ll = long long;

vector<pair<int, int> > prime_factorize(int N) {
    vector<pair<int, int> > res;
    for (int a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        int ex = 0;

        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

vector<int> divisors(int n){
    vector<int> res;
    for(int i=1; i*i <= n; i++){
        if(n%i == 0){
            res.push_back(i);
            if(n/i != i) res.push_back(n/i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

int main (){
    int k;
    cin >> k;
    int a, b, c;

    int ans = 0;

    repk(i, 1, k+1){
        repk(j, 1, k+1){
            if(i*j > k) break;
            repk(l, 1, k+1){
                if(i*j*l>k) break;
                if(i*j*l <=k) ans++;
            }
        }
    }

    cout << ans << endl;
    return 0;
}


#include <cstdio>
const int maxn=100+10;
struct E{
	int to;
	int next;
}ed[maxn*maxn*2];
int head[maxn];
int tot;
void J(int a,int b){
	ed[++tot].to=b;
	ed[tot].next=head[a];
	head[a]=tot;
}
int en;
int vis[maxn];
int ans;
void Dfs(int x){
	if(x==en+1){
		ans++;
		return;
	}
	if(!head[x]){
		Dfs(x+1);
		return;
	}
	for(int i=head[x];i;i=ed[i].next){
		if(vis[ed[i].to]){
			Dfs(x+1);
			return;
		}
	}
	Dfs(x+1);
	vis[x]=1;
	Dfs(x+1);
	vis[x]=0;
}
long long gcd(long long a,long long b){
	return b?gcd(b,a%b):a;
}
int main(){
	long long a,b;
	scanf("%lld%lld",&a,&b);
	en=b-a+1;
	for(int i=1;i<=b-a+1;i++)
		for(int j=1;j<=b-a+1;j++){
			if(i==j)
				continue;
			if(gcd(a+i-1,a+j-1)!=1){
				J(i,j);
				J(j,i);
			}
		}
	Dfs(1);
	int ha=0;
	for(int i=1;i<=b-a+1;i++)
		if(!head[i])
			ha++;
	printf("%lld",1ll*ans*(1ll<<ha));
	return 0;
}

//
//abc195_e
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define reps(i,s,n) for(int i=s;i<n;++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int p[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71};
const int n = 20;
const ll bn = 1 << n;
ll dp[75][bn];

int main()
{
    ll a,b;
    cin >> a >> b;
    dp[0][0] = 1;
    int idx = 0;
    for(ll i = a; i<= b; ++i)
    {
        ll ai = i;
        ll pi = 0;
        rep(j,n) if(ai%p[j]==0) pi |= (1<<j);//(pi+=(1<<j)と同じ)
        rep(s,bn)
        {
            //aiを選択しない
            dp[idx+1][s] += dp[idx][s];
            //aiを選択する（sにaiの素因数がない場合に可能）
            if((s&pi) == 0) dp[idx+1][s|pi] += dp[idx][s];
        }
        ++idx;
    }
    ll ans = 0;
    rep(s,bn) ans += dp[idx][s];
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int n;
string s;
vector<int> a;

vector<vector<int>> solve();

int main() {
  cin >> n >> s;
  a.resize(n + 1);
  for (auto &p : a) cin >> p;
  auto res = solve();
  cout << res.size() << endl;
  for (auto &v : res)
    for (int i = 0; i <= n; ++i) cout << v[i] << " \n"[i == n];
  return 0;
}

vector<vector<int>> solve() {
  vector<int> b(n + 1, 0);
  for (int i = 0; i <= n; ++i) {
    int now = i;
    while (now && s[now - 1] == '>')
      b[now - 1] = max(b[now - 1], b[now] + 1), --now;
    now = i;
    while (now < n && s[now] == '<')
      b[now + 1] = max(b[now + 1], b[now] + 1), ++now;
  }
  vector<vector<int>> res;
  auto check = [](vector<int> &v) {
    for (int i = 0; i < n; ++i) {
      if (s[i] == '<' && v[i] >= v[i + 1]) return 0;
      if (s[i] == '>' && v[i] <= v[i + 1]) return 0;
    }
    return 1;
  };
  auto f = [&](int i) {
    vector<vector<int>> v(i, b);
    vector<int> rem(n + 1, 0);
    bool ch = 1;
    for (int j = 0; j <= n; ++j) {
      rem[j] = a[j] - i * b[j];
      if (rem[j] < 0) ch = 0;
    }
    if (!ch) return vector<vector<int>>();
    for (int j = 0; j < i; ++j)
      for (int k = 0; k <= n; ++k) v[j][k] += rem[k] / i + (rem[k] % i > j);
    for (int j = 0; j < i; ++j)
      if (!check(v[j])) {
        ch = 0;
        break;
      }
    if (!ch) return vector<vector<int>>();
    return v;
  };
  int l = 1, r = 10001;
  while (r - l > 1) {
    int mid = (l + r) >> 1;
    if (f(mid).size())
      l = mid;
    else
      r = mid;
  }
  return f(l);
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <fstream>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define x first
#define y second
#define Time (double)clock()/CLOCKS_PER_SEC
#define debug(x) std::cerr << #x << ": " << x << '\n';
#define FOR(i, n) for (int i = 0; i < n; ++i)
#define FORN(i, n) for (int i = 1; i <= n; ++i)
#define pb push_back
#define trav(a, x) for (auto& a : x)
using vi = vector<int>;
template <typename T>
std::istream& operator >>(std::istream& input, std::vector<T>& data)
{
    for (T& x : data)
        input >> x;
    return input;
}
template <typename T>
std::ostream& operator <<(std::ostream& output, const pair <T, T> & data)
{
    output << "(" << data.x << "," << data.y << ")";
    return output;
}
template <typename T>
std::ostream& operator <<(std::ostream& output, const std::vector<T>& data)
{
    for (const T& x : data)
        output << x << " ";
    return output;
}
ll div_up(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll div_down(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down
ll math_mod(ll a, ll b) { return a - b * div_down(a, b); }
#define tcT template<class T
#define tcTU tcT, class U
tcT> using V = vector<T>;
tcT> void re(V<T>& x) {
    trav(a, x)
        cin >> a;
}
tcT> bool ckmin(T& a, const T& b) {
    return b < a ? a = b, 1 : 0;
} // set a = min(a,b)
tcT> bool ckmax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0;
}
ll gcd(ll a, ll b) {
    while (b) {
        tie(a, b) = mp(b, a % b);
    }
    return a;
}
signed main() {
    #ifdef LOCAL
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    int n;
    cin >> n;
    vi a(2 * n);
    cin >> a;
    multiset <int> ms;
    int ans = 0;
    trav (e, a)
    	ans += e;
    FOR (i, n) {
    	int l = n - 1 - i;
    	int r = n + i;
    	ms.insert(a[l]);
    	ms.insert(a[r]);
    	ans -= *ms.begin();
    	ms.erase(ms.begin());
    }
    cout << ans << endl;
}


#include<iostream>
#include<bits/stdc++.h>
#define int long long int
#define vi vector<int>
#define fo(i,n) for(int i=1;i<=n;i++)
#define foo(i,n) for(int i=0;i<n;i++)
#define sort(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define uniq(v) sort(v); v.resize(unique(v.begin(), v.end())-v.begin());
#define ff first
#define ss second
#define pb push_back
#define pii pair<int,int>
#define ok ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#define vp vector<pair<int,int>>
#define mod 1000000007
const int huge = 1e17;

int max(int a,int b){ if(a>b) return a; return b; }
int min(int a,int b){ if(a<b) return a; return b; }
int abbs(int a,int b){   if(a-b < 0) return b-a; return a-b; }

int lowerB(vi &v, int val){
int ind=v.size(),l=0,r=v.size(),mid;while(l<=r){mid=(l+r)/2;if(v[mid]>=val){ind=mid;r=mid-1;}else l=mid+1;}return ind;
}

void solve(){
    int n; cin>>n; vi v(n); foo(i,n) cin>>v[i];
    vi pre(n); int x = 0;
    foo(i,n) x+=v[i], pre[i] = x;

    vector<vector<int>> dp(n+500,vector<int>(n+500,0));
    dp[1][0] = 1;
    int ans = 0;
    for(int i=0; i<n; i++) {
        for(int j=n; j>=1; j--) {
           dp[j+1][pre[i]%(j+1)] += dp[j][pre[i]%j];
           dp[j+1][pre[i]%(j+1)]%=mod;
           if(i==n-1) {
            ans+=dp[j][pre[i]%j];
            ans%=mod;
           }
        }
    }

    cout<<ans;
}

signed main(){
   ok
   int t;
   t = 1;
   //cin>>t;
     while(t--){
      solve();
    }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_set>
#include <unordered_map>
#define all(a) a.begin(), a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define range(i, a, b) for (ll i = (a); i < (b); i++)
#define rrange(i, a, b) for (ll i = (b) - 1; i >= (a); i--)
#define pb push_back
#define debug(x) cerr << __LINE__ << ' ' << #x << ':' << (x) << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
template<class T> using pri_s = priority_queue<T, vector<T>, greater<T>>;
template<class T> using pri_b = priority_queue<T>;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr int mod1e9 = 1000000007;
constexpr int mod998 = 998244353;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
constexpr ll ten(int n) { return n ? 10 * ten(n - 1) : 1; };
int dx[] = { 1,0,-1,0,1,1,-1,-1 }; int dy[] = { 0,1,0,-1,1,-1,1,-1 };
void fail() { cout << "-1\n"; exit(0); } void no() { cout << "No\n"; exit(0); }
template<class T> void er(T a) { cout << a << '\n'; exit(0); }
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }
template<class T> istream &operator >> (istream &s, vector<T> &v) { for (auto &e : v) s >> e; return s; }
template<class T> ostream &operator << (ostream &s, const vector<T> &v) { for (auto &e : v) s << e << ' '; return s; }
template<class T, class U> ostream &operator << (ostream &s, const pair<T, U> &p) { s << p.first << ' ' << p.second; return s; }

struct fastio {
	fastio() {
		cin.tie(0); cout.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(20);
		cerr << fixed << setprecision(20);
	}
}fastio_;

class unionfind {
	vector<int> par;
	vector<int> sz;
public:
	unionfind(int n) {
		par = vector<int>(n);
		for (int i = 0; i < n; i++) par[i] = i;
		sz = vector<int>(n, 1);
	}
	int find(int x) {
		if (par[x] == x) return x;
		else return par[x] = find(par[x]);
	}
	int size(int x) { return sz[find(x)]; }
	bool same(int x, int y) { return find(x) == find(y); }
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (sz[x] < sz[y]) {
			par[x] = y;
			sz[y] += sz[x];
		}
		else {
			par[y] = x;
			sz[x] += sz[y];
		}
	}
};

int main() {
	int h, w;
	cin >> h >> w;
	vector<vector<char>> a(h, vector<char>(w));
	rep(i, h) rep(j, w) cin >> a[i][j];
	unionfind uni(h + w);
	uni.unite(0, h);
	uni.unite(0, h + w - 1);
	uni.unite(h - 1, h);
	uni.unite(h - 1, h + w - 1);
	rep(i, h) rep(j, w) if (a[i][j] == '#') uni.unite(i, h + j);
	set<int> x, y;
	rep(i, h) x.insert(uni.find(i));
	for (int i = h; i < h + w; i++) y.insert(uni.find(i));
	int ans = min(x.size(), y.size());
	cout << ans - 1 << '\n';
}

#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define me memset
#define rep(a,b,c) for(int a=b;a<=c;++a)
#define per(a,b,c) for(int a=b;a>=c;--a)
const int N = 1e6 + 10;
const int mod = 998244353;
const int INF = 0x3f3f3f3f;
using namespace std;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}

ll f[N],invf[N];
ll fpow(ll a,ll k){
	ll res=1;
	while(k){
		if(k&1) res=(res*a)%mod;
		k>>=1;
		a=a*a%mod;
		//cout<<1<<endl;
	}
	return res;
}

void init(int n){
	f[0]=1;
	for(int i=1;i<=n;++i){
		f[i]=f[i-1]*i%mod;
	}
	invf[n]=fpow(f[n],mod-2);
	for(int i=n-1;i>=0;--i){
		invf[i]=invf[i+1]*(i+1)%mod;
	}
}

ll C(int n,int k){
	if(k<0 || k>n) return 0;
	return f[n]*invf[k]%mod*invf[n-k]%mod;
}

ll dp[25][N];

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    init(2e5+10);
    int n,m;
    cin>>n>>m;

    rep(i,1,m) dp[1][i]=1;

    rep(i,1,19){
        rep(j,1,m){
            for(int k=2;k*j<=m;++k){
                dp[i+1][k*j]+=dp[i][j];
            }
        }
    }

    ll ans=0;
    rep(i,1,19){
        rep(j,1,m){
            ans=(ans+C(n-1,i-1)*dp[i][j]%mod)%mod;
        }
    }

    cout<<ans<<'\n';

return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n;
double ans;
bool can[105][105];

int main() {
	cin>>n;
	for (int i=1; i<=n; ++i)
		for (int j=1; j<=n; ++j) {
			char c; cin>>c;
			can[i][j]=c=='1';
		}
	for (int i=1; i<=n; ++i)
		can[i][i]=1;
	for (int k=1; k<=n; ++k)
		for (int i=1; i<=n; ++i)
			for (int j=1; j<=n; ++j)
				can[i][j]|=can[i][k]&&can[k][j];
	for (int i=1; i<=n; ++i) {
		int now=0;
		for (int j=1; j<=n; ++j)
			now+=can[j][i];
		ans+=1.0/now;
	}
	printf("%.13lf",ans);
}

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll> pql;
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef map<ll, ll> ml;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, k, n) for(ll i = ll(k); i <= ll(n); i++)
#define rep3(i, n, k) for(ll i = ll(n); i >= ll(k); i--)
#define all(v) (v).begin(), (v).end()
ll mod(ll a, ll b) {return (a % b + b) % b;}
ll quo(ll a, ll b) {return (a - mod(a, b)) / b;}
template <typename T, typename U> bool chmin(T &a, const U b) {if(a > b) {a = b; return 1;} return 0;}
template <typename T, typename U> bool chmax(T &a, const U b) {if(a < b) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 2e5;
const ld eps = 1e-9;
const char newl = '\n';

ll itr1, itr2, M1 = 0, M2 = 0;
bool found = 0;
vl e, d1, d2;
vb diam;
vvl G;

void dfs1(ll v) {
  for(ll u: G[v]) {
    if(d1[u] == INF) {
      d1[u] = d1[v] + 1;
      dfs1(u);
    }
  }
  return;
}

void dfs2(ll v) {
  for(ll u: G[v]) {
    if(d2[u] == INF) {
      d2[u] = d2[v] + 1;
      dfs2(u);
    }
  }
  return;
}

void dfs3(ll v) {
  if(v == itr2) {
    found = 1;
    return;
  }
  for(ll u: G[v]) {
    if(found) break;
    if(d2[v] < d2[u]) dfs3(u);
    if(found) diam[u] = 1;
  }
  return;
}

ll dfs4(ll v, ll num) {
  e[v] = num;
  ll last = -1;
  for(ll u: G[v]) {
    if(e[u] == INF) {
      if(diam[u]) {
        last = u;
        continue;
      }
      num = dfs4(u, num+1);
    }
  }
  if(last != -1) num = dfs4(last, num+1);
  return num+1;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll n, a, b;
  cin >> n;
  e = vl(n, INF);
  d1 = vl(n, INF);
  d2 = vl(n, INF);
  diam = vb(n, 0);
  G = vvl(n);
  rep(_, n-1) {
    cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  d1[0] = 0;
  dfs1(0);
  rep(i, n) if(chmax(M1, d1[i])) itr1 = i;
  d2[itr1] = 0;
  dfs2(itr1);
  rep(i, n) if(chmax(M2, d2[i])) itr2 = i;
  dfs3(itr1);
  dfs4(itr1, 1);
  //cout << itr1 << " " << itr2 << newl;
  //rep(i, n) if(diam[i]) cout <<i << newl;
  rep(i, n) cout << e[i] << ' ';
  cout << newl;
  return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long
#define ull unsigned long long
#define all(x) (x).begin(),(x).end()
#define print(x) if(x)cout<<"YES\n";else cout<<"NO\n";
#define pb push_back
#define F first
#define S second
//#define mod 1000000007
#define mod 998244353
using namespace __gnu_pbds;
using namespace std;
void solve() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << 21 - a - b - c << "\n";
}
int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	fastio;
	int T = 1;
	// cin>>T;
	while (T--) {
		solve();
	}
}

#include <iostream>
#include <vector>

using namespace std;
using llint = long long;
#define rep(i,n) for(int i=0;i<(n);++i);

int main() {
  llint a,b,c;
  cin >> a >> b >> c;
  cout << (7-a) + (7-b) + (7-c) << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const LL mod = 1e9 + 7;
const int N = 100005;

LL n, m;
__int128 zh(__int128 x) {
    return x * (x - 1) * (x - 2) / 6;
}
__int128 cal(__int128 x) {
    __int128 res = zh(x);
    if (x > n) res -= 3 * zh(x - n);
    if (x > 2 * n) res += 3 * zh(x - 2 * n);
    return res;
}
int main() {

    cin >> n >> m;
    LL l = 3, r = n * 3;
    while (l < r) {
        LL mid = l + r >> 1;
        if (cal(mid) >= m)
            r = mid;
        else
            l = mid + 1;
    }
    m -= cal(l - 1);
    for (int i = 1; i <= n; i++) {
        int x = max(1LL, l - i - n), y = min(n, l - i - 1);
        int len = y - x + 1;
        if (len <= 0) continue;
        if (m > len)
            m -= len;
        else {
            x += m - 1;
            printf("%d %d %d\n", i, x, l - x - i);
            break;
        }
    }
    return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma comment(linker, "/stack:200000000")

using namespace std;
using namespace __gnu_pbds;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define F first
#define S second
#define gcd __gcd
#define lcm(a, b) (ull(a) / gcd(a, b) * b)
#define sz(x) (int)(x).size()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define mkp make_pair
#define mkt make_tuple
#define mem(x) memset(x, 0, sizeof(x))
#define deci(x) fixed << setprecision(x)
#define zero(x) setw(x) << setfill('0')
#define EACH(v, u) for(auto& v : u)
#define lowbit(x) (x & -x)
#define dbg(...) cerr << "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

typedef uint32_t uint;
typedef int64_t ll;
typedef uint64_t ull;
typedef long double ld;
#define vt vector
#define Q queue
#define pq priority_queue
#define mset multiset
#define uset unordered_set
#define umap unordered_map
#define ar array
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vt<T>, greater<T>>;
template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<class T, class U> ostream& operator<<(ostream& os, pair<T, U> p) { return os << p.F << " " << p.S; }
template<class T> ostream& operator<<(ostream& os, vt<T> v) { EACH(u, v) os << u << " "; return os; }

template<class T> void read(T& x) { cin >> x; }
template<class T, class... U> void read(T& a, U&... b) { read(a), read(b...); }
template<class T> void write(T x) { cout << x;}
template<class T, class... U> void write(T a, U... b) { write(a), write(" "), write(b...), write("\n"); }

string operator*(string a, int x) { string ret = a; for(int i = 1; i < x; ++i) ret += a; return ret; }
string& operator*=(string& a, int x) { return a = a * x; }

ull fpm(ull a, ull b, ull m) { ull ret = 1;	while(b) { if(b & 1) ret = ret * ret % m; a = a * a % m; b >>= 1; } return ret; }

const int INF(1e9);
const ll LINF(1e17);
const ld pi(3.141592653589793238);

const int d4i[4] = {-1, 0, 1, 0}, d4j[4] = {0, 1, 0, -1};
const int d8i[8] = {-1, -1, -1, 0, 0, 1, 1, 1}, d8j[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

int main() {
	fastio;
	int a, b, c;
	cin >> a >> b;
	if(a == b)
		cout << a << "\n";
	else {
		c = 0 ^ 1 ^ 2 ^ a ^ b;
		cout << c << "\n";
	}

	return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=998244353;

int n,m,ans=1;
char s[508][508];

signed main() {
	scanf("%lld%lld",&n,&m);
	for(int i=1; i<=n; i++)
		for(int j=1; j<=m; j++)
			cin>>s[i][j];
	for(int j=2; j<=n+m; j++) {
		int flag=0,ok=1,sum=1;
		for(int i=1; i<j; i++) {
			if(i>n||j-i>m) continue;
			if(flag!=0){
				if(s[i][j-i]=='B'&&flag==1) ok=0;
				if(s[i][j-i]=='R'&&flag==-1) ok=0;
			}
			if(s[i][j-i]=='R'&&flag==0) flag=1;
			if(s[i][j-i]=='B'&&flag==0) flag=-1;
			if(s[i][j-i]!='.') sum=0;
		}
		if(ok==0) ans=0;
		else if(sum) ans=ans*2%mod;
	}
	printf("%lld\n",ans);
	return 0;
}

#include <bits/stdc++.h>

#define f(i,a,b) for( ll i = a; i < b ; i++ )
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)

// policy-based
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

using namespace std;

typedef long long ll; // int or long long
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;

/*
typedef tree<
ll,
null_type,
less<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
*/

const ll MAX = 1e3 + 100;
const ll inf = 1e9;
const ll mod = 998244353;

ll c[100][100];

struct DSU{
	ll p[200],sz[200];
	void ini(ll n){
		f(i,0,n) p[i] = i,sz[i] = 1;
 	}
	ll find(ll u){
		return (p[u]==u?u:p[u]=find(p[u]));
	}
	void uni(ll u,ll v){
		ll x = find(u),y = find(v);
		if(x == y) return;
		p[y] = x;
		sz[x] += sz[y];
	}
};

DSU a,b;

ll fac[MAX];

int main(){
	fastio;
	fac[0] = 1;
	f(i,1,MAX) fac[i] = (fac[i-1]*i) % mod;
	ll n,k,ans = 1;
	cin >> n >> k;
	f(i,0,n) f(j,0,n) cin >> c[i][j];
	a.ini(n);
	b.ini(n);
	f(x,0,n){
		f(y,x+1,n){
			bool go = true;
			f(i,0,n) if(c[i][x] + c[i][y] > k) go = false;
			if(go) a.uni(x,y);
		}
	}
	f(x,0,n){
		f(y,x+1,n){
			bool go = true;
			f(i,0,n) if(c[x][i] + c[y][i] > k) go = false;
			if(go) b.uni(x,y);
		}
	}

	f(i,0,n) if(a.find(i) == i) (ans *=  fac[a.sz[i]] )%=mod;
	f(i,0,n) if(b.find(i) == i) (ans *=  fac[b.sz[i]] )%=mod;
	cout << ans << endl;
}


#ifdef Icry
#include "debug.h"
#else
#include <bits/stdc++.h>
#define debug(args...)
#endif

using namespace std;

const int N = 1e5 + 10;
int dp[111][N], a[111], n, sum = 0;

int go(int i, int t) {
      if (i == n) return max(t, sum - t);

      int &ret = dp[i][t];
      if (~ret) return ret;

      ret = min(go(i + 1, t + a[i]), go(i + 1, t));

      return ret;
}

int main() {
      #ifdef Icry
            auto begin = chrono :: high_resolution_clock :: now();
      #endif
      ios_base :: sync_with_stdio(0);
      cin.tie(0);

      cin >> n;
      for (int i = 0; i < n; ++i) cin >> a[i], sum += a[i];
      // sort(a, a + n);
      // reverse(a, a + n);

      memset(dp, -1, sizeof dp);
      cout << go(0, 0) << '\n';

      #ifdef Icry
            auto end = chrono :: high_resolution_clock :: now();
            cerr << setprecision(4) << fixed;
            cerr << "[Execution time: " << chrono :: duration_cast <chrono :: duration <double>> (end - begin).count() << " seconds]\n";
      #endif
}

#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
int num[N];
int dp[N];
int main()
{
	int n;
	cin>>n;
	int sum=0;
	for(int i=1;i<=n;i++)
		cin>>num[i],sum+=num[i];
	if(n==1)
	{
		cout<<num[1];
		return 0;
	}
	dp[0]=1;
	int temp=sum;
	sum/=2;
	for(int i=1;i<=n;i++)
		for(int j=sum;j>=num[i];j--)
			if(dp[j-num[i]])
				dp[j]=1;
	for(int i=sum;i>=1;i--)
		if(dp[i])
		{
			cout<<temp-i;
			return 0;
        }
}


#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int N,A[102];
	scan(N);
	rep(i,N) scan(A[i]);
	int maxdo=0;
	int ans;
	for(int k=2;k<=1000;k++){
		int cnt=0;
		rep(i,N) cnt+=(A[i]%k==0);
		if(maxdo<cnt){
			maxdo=cnt;
			ans=k;
		}
	}
	prin(ans);
	return 0;
}