#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
vector <int> wood;
queue <int> wood_break;
int cnt = 0,n,maxn = 0;
bool check(){
for(int i = 1; i < cnt; i++) if(wood[i] != wood[0]) return false;
return true;
}
void searchx(){
if(wood_break.empty() && check()){
maxn = max(maxn,wood[0]);
return;
}
int tmp = wood_break.front();
wood_break.pop();
for(int i = 0; i < cnt; i++){
wood[i] += tmp;
searchx();
wood[i] -= tmp;
}
wood.push_back(tmp);
cnt++;
searchx();
cnt--;
wood.pop_back();
wood_break.push(tmp);
return;
}
int main(){
scanf("%d",&n);
for(int i = 0; i < n; i++){
int tmp;
scanf("%d",&tmp);
wood_break.push(tmp);
}
searchx();
printf("%d",maxn);
return 0;
}