#include #include #include #include #include #include #include using namespace std; typedef pair P; typedef long long ll; #define For(i, a, b) for(int i = (a); i < (b); i++) #define Rep(i, n) For(i, 0, (n)) const int inf = 999999999; const int mod = 1000000007; P dp[1 << 16]; int main(){ int n; cin >> n; int monster[n]; Rep(i, n){ cin >> monster[i]; } dp[0].first = 100; dp[0].second = 100; For(i, 0, 1 << n){ For(j, 0, n){ if((1 << j & i) == 0 && dp[i].second != 0){ dp[i | 1 << j].first = max(dp[i | 1 << j].first, max(0, min(dp[i].first + monster[j], dp[i].second))); int t = dp[i | 1 << j].first; if(t == 0){ dp[i | 1 << j].second = 0; }else{ dp[i | 1 << j].second = dp[i].second + 100; } } } } int ans = dp[(1 << n) - 1].first; cout << ans << endl; return 0; }