#include <bits/stdc++.h>
using namespace std;
const int LIM_STOCKS = 100;
const int LIM_MONEY = 10000;
int A[81], done[81][LIM_STOCKS + 1][LIM_MONEY + 1];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> A[i];
  int ans = 0;
  done[0][0][1000] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= LIM_STOCKS; j++) {
      for (int k = 0; k <= LIM_MONEY; k++) {
        if (done[i][j][k] == 0) continue;
        for (int x = 0; x <= j; x++) done[i + 1][j - x][k + A[i + 1] * x] = 1;
        for (int x = 0; k >= A[i + 1] * x; x++)
          done[i + 1][j + x][k - A[i + 1] * x] = 1;
      }
    }
  }
  for (int i = 0; i <= LIM_STOCKS; i++)
    for (int j = 0; j <= LIM_MONEY; j++)
      if (done[n][i][j]) ans = max(ans, j);
  cout << ans << "\n";
  return 0;
}
