#include #include #include #include #include #include #include #include #include #include #include #define REP(i,n) for(int i=0;i<(int)(n);i++) using namespace std; typedef long long int ll; typedef pair P; int N,m=-1; vector sets(0); bool bo[16384]; void solve(int code,int mochi,int d){ int back=code; if(code == 0){ m = max(m,mochi); return; } else{ for(int i=d;i> i)&1){ code = code ^ (1 << i); for(int j=i+1;j> j) & 1){ code = code ^ (1 << j); solve(code,mochi^(sets[i]+sets[j]),1); code = code ^ (1 << j); } } break; code = back; } } } } int main() { int A; cin >> N; REP(i,N){ cin >> A; sets.push_back(A); } fill(bo,bo+16384,false); sort(sets.begin(),sets.end()); solve((1 << N)-1,0,0); cout << m << endl; return 0; }