#include <bits/stdc++.h>
using namespace std;
int n,max1 = -1,sum1;
bool pd = 0;
int a[75];
bool b[75];
inline void read(int& a){
int s = 0, w = 1;
char ch = getchar();
while (ch < '0' || ch>'9'){
if (ch == '-') w = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9'){
s = s * 10 + ch - '0';
ch = getchar();
}
a = s * w;
}
void dfs(int i,int k,int sum,int r,int last){
if(sum == i){
int c = 0;
for(int c=last;c<=n;c++){
if(b[c]==0){
break;
}else if(c == n){
if(k == 1) pd = 1;
return;
}
}
b[c] = 1;
dfs(i,k-1,a[c],c,c);
}
for(int j=r+1;j<=n;j++){
if(b[j] == 0 && sum+a[j] <= i){
b[j]=1;
dfs(i,k,sum+a[j],j,last);
b[j]=0;
}
}
}
bool cmp(int x,int y){return x>y;}
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
read(a[i]);
sum1+=a[i];
}
sort(a+1,a+1+n,cmp);
max1 = a[1];
for(int i=max1;i<=sum1;i++){
if(sum1%i == 0){
memset(b,0,sizeof(b));
b[1] = 1;
dfs(i,sum1/i,a[1],1,1);
if(pd == 1){
printf("%d",i);
return 0;
}
}
}
return 0;
}