#include <cstdio>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <cstdlib>
const int N = 66;
using namespace std;
short n, a[N], node[N], sum, maxn, tag;
inline void dfs(short len, short k, short r) {
if (k == tag&&r==0) {
printf("%d", len);
exit(0);
}
if (r == 0) {
dfs(len, k + 1, len);
return ;
}
short key = (lower_bound(a + 1, a + 1 + a[0], r,greater<short>()) - a) ;
while (key<=a[0]) {
if(node[a[key]]){
node[a[key]]--;
dfs(len,k,r-a[key]);
node[a[key]]++;
if(r-a[key]==0)return;
}
key++;
}
return ;
}
inline bool cm_p(short a, short b) {
return a > b;
}
int main() {
scanf("%d", &n);
short x;
for (short i = 1; i <= n; i++) {
scanf("%d", &x);
if (x > 50)continue;
sum += x;
maxn = max(maxn, x);
if (!node[x])a[++a[0]] = x;
node[x]++;
}
sort(a + 1, a + 1 + a[0], cm_p);
for (short i = maxn; i <= sum / 2; i++) {
if (sum % i != 0)continue;
tag = sum / i;
dfs(i, 1, i);
}
printf("%d", sum);
return 0;
}