#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
int a[114];
bool vst[114];
int n,len,all,sum;
bool cmp(int x,int y){
return x>y;
}
bool dfs(int lost,int now,int last=0){
if(now==1) return true;
if(lost==0) return dfs(len,now-1);
int un=0;
for(int i=last+1;i<=n;i++){
if(vst[i]==false&&a[i]<=lost&&a[i]!=un){
vst[i]=true;
if(dfs(lost-a[i],now,i)==true) return true;
vst[i]=false;
un=a[i];
if(len==a[i]||lost==len) return false;
}
}
return false;
}
int main(){
int m,maxn=0;
cin>>m;
while(m--){
int tmp;
cin>>tmp;
if(tmp>50) continue;
a[++n]=tmp;
sum+=tmp;
maxn=max(maxn,tmp);
}
sort(a+1,a+n+1,cmp);
for(len=maxn; ;len++){
if(sum%len!=0) continue;
memset(vst,0,sizeof(vst));
all=sum/len;
if(dfs(len,all)==true){
cout<<len;
return 0;
}
}
}