#include<bits/stdc++.h>
using namespace std;
int n,sum,lenth;
int len[101];
bool vis[101];
bool dfs(int now,int part,int start){
if(now*lenth == sum)return true;
if(part == lenth) return dfs(now+1,0,0);
for(int i=start;i<=n;i++){
if(vis[i])continue;
if(len[i]+part > lenth)continue;
vis[i] = true;
if(dfs(now,len[i]+part,i+1)){
return true;
}
vis[i] = false;
if(!part|| len[i]+part==lenth) {
return false;
}
int j = i;
while(j<=n&&len[j]==len[i]){
j++;
}
i=j-1;
}
return false;
}
int main()
{
cin>>n;
for(int i=1;i<=n;i++){
cin>>len[i];
sum+=len[i];
}
sort(len+1,len+n+1);
reverse(len+1,len+n+1);
for(lenth=1;lenth<=sum;lenth++){
if(sum%lenth==0 && dfs(0,0,0)){
cout<<lenth<<endl;
break;
}
}
return 0;
}