#define _GLIBCXX_DEBUG #include #include #include #include #include #include #include #include #include using namespace atcoder; using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i,a,b) for(ll i=a;i>=b;i--) #define all(v) v.begin(), v.end() #define pb push_back #define mp make_pair using Graph = vector>; const ll INF = 1LL << 60; const int inf = 1 << 29; using P = pair; const ll mod = 1000000007; vector dx={1,-1,0,0}; vector dy={0,0,1,-1}; int A[14],dp[1<<14]; int main() { int N; cin>>N; rep(i,N) cin>>A[i]; rep(msk,1 << N){ rep(a,N) rep(b,a) if(!(msk&(1<