#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

ll dp[202][15];

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int L;
  cin>>L;

  dp[0][0]=1;
  for(int i=0;i<L;i++){
    for(int j=0;j<=11;j++){
        dp[i+1][j]+=dp[i][j];
        if(j+1<=11){
          if(j+1==11&&i+1==L) continue;
          dp[i+1][j+1]+=dp[i][j];
        }
    }
  }

  cout<<dp[L][11]<<endl;

  return 0;
}

#include <bits/stdc++.h>

#define endl "\n" 
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;

constexpr int N = 1e5 + 5;
constexpr int mod = 1e9 + 7;
constexpr int LOG = 18;

template<typename T> void dout(const T& x) { cout << x << ' '; } // change separator!
template<typename T, typename ...Ts> void dout(const T& v, const Ts&... args) { dout(v); dout(args...); }
template<typename ...Ts> void vout(const Ts&... args) { dout(args...); cout << endl; exit(0); }

bitset<N> dp;
int n, v, s = 0;


void solve() {
  cin >> n;
  dp[0] = 1;
  while(n--) {
    cin >> v;
    s += v;
    dp |= (dp << v);
  }
  int ans = N;
  for (int i = 0; i <= s; i++)
    if (dp[i])
    ans = min(ans, max(i, s - i));
  cout << ans << endl;
}

int main() {
  //freopen("zhopa.txt", "r", stdin);
  //freopen("logins.txt", "w", stdout);
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  // int tests;
  // cin >> tests;
  // while(tests--)
  // auto start = chrono::high_resolution_clock::now();
    solve();
  // auto end = chrono::high_resolution_clock::now();
  // cout << endl << (chrono::duration_cast<chrono::duration<double>>(end - start)).count();
  return 0;
}
