#include<bits/stdc++.h>
using namespace std;
int n,s,maxx,cnt,l;
int a[100],b[100];
bool f[100];
bool f1;
void dfs(int x,int y,int z){
if(x==cnt){
f1=1;
return ;
}
if(z==0){
int i=1;
while(f[i]==1&&i<n) i++;
f[i]=1;
dfs(x+1,i,l-a[i]);
f[i]=0;
if(f1==1) return ;
}
for(int i=y+1;i<=n;i++){
if(f[i]==0&&z>=a[i]){
f[i]=1;
dfs(x,i,z-a[i]);
f[i]=0;
int ii=i;
while(i<n&&a[i]==a[ii]) i++;
if(i==n) return ;
}
}
}
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
maxx=max(maxx,a[i]);
s+=a[i];
}
sort(a+1,a+1+n,greater<int>());
for(int i=maxx;i<=s;i++){
if(s%i==0){
l=i,cnt=s/i;
f1=0;
f[1]=1;
dfs(1,1,l-a[1]);
f[1]=0;
if(f1==1){
cout<<i;
return 0;
}
}
}
cout<<s<<endl;
return 0;
}