#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 1000+5;
const int dx[] = {-1,1,0,0,-1,-1,1,1};
const int dy[] = {0,0,-1,1,-1,1,-1,1};
using namespace std;
int a[N];
bool vis[N];
int cnt;
bool cmp(int x,int y){
return x>y;
}
bool dfs(int k,int step,int rest,int len){
if(k==cnt+1 && rest==0)
return true;
else if(k==cnt+1)
return false;
else if(rest==0){
rest=len;
step=0;
}
for(int i=step+1;i<=cnt;i++){
if(!vis[i]){
if(rest-a[i]>=0){
vis[i]=true;
if(dfs(k+1,i,rest-a[i],len))
return true;
vis[i]=false;
if(a[i]==rest || len==rest)
break;
while(a[i]==a[i+1])
i++;
}
}
}
return 0;
}
int main(){
int n;
scanf("%d",&n);
int sum=0;
for(int i=1;i<=n;i++){
int x;
scanf("%d",&x);
if(x<=50){
a[++cnt]=x;
sum+=x;
}
}
sort(a+1,a+1+cnt,cmp);
for(int i=a[1];i<=sum;i++){
if(sum%i==0){
if(dfs(1,0,i,i)){
printf("%d\n",i);
break;
}
}
}
return 0;
}