#include #include #include #include #include #include using namespace std; #define rep(i, N) for (int i = 0; i < N; i++) #define repi(i, ini, N) for(int i = ini; i < N; i++) #define chmax(i, j) i = max(i, j) #define chmin(i, j) i = min(i, j) typedef long long ll; int N; ll dp[1<<15]; ll M[15]; const ll INF = 1<<29; int main() { cin >> N; rep(i, N) cin >> M[i]; rep(msk, 1<