#include using namespace std; using ll = long long; using vll = vector; using pll = pair; #define sz(x) ((ll)(x).size()) #define For(i, a, n) for(ll i = a; i < (ll)(n); i++) #define vec vector const ll MOD = 1e9+7; template ostream& operator<<(ostream &os, const vector &cont) { for (auto it = cont.begin(); it != cont.end(); ++it) os << (it == cont.begin() ? "" : " ") << *it; return os; } template ostream& operator<<(ostream &os, const pair &cont) { os << "(" << cont.first << ", " << cont.second << ")"; return os; } vec> memo(1<<22, vec(22)); int maxa=21; ll solve (ll m, int l){ if(memo[m][l])return memo[m][l]; memo[m][l] = 0; For(i, 1, maxa){ if(m&(1<>n; vec a(n); ll m=0; For(i, 0, n){ cin>>a[i]; if(!(m&1< poc(maxa); for(auto i:a){ poc[i]++; } ll ans = solve(m, 1) - 1; For(i, 0, maxa){ if(poc[i]>1) ans += (poc[i]-1)*i; } cout<