#include <bits/stdc++.h>
#define rint register int
using namespace std;
const int N = 70;
int a[N];
bool st[N];
int length;
int n, sum;
inline int read()
{
int x = 0, y = 1; char c = getchar();
while (!isdigit(c)) c = getchar();
while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
return x * y;
}
inline bool cmp(int i, int j)
{
return a[i] > a[j];
}
inline bool dfs(int u, int s, int start)
{
if (u * length == sum) return true;
if (s == length) return dfs(u + 1, 0, 1);
for (rint i = start; i <= n; i++)
{
if (st[i]) continue;
if (s + a[i] > length) continue;
st[i] = true;
if (dfs(u, s + a[i], i + 1)) return true;
st[i] = false;
if (!s) return false;
if (s + a[i] == length) return false;
int j = i;
while (j <= n && a[i] == a[j]) j++;
i = j - 1;
}
return false;
}
int main()
{
n = read();
for (rint i = 1; i <= n; i++) a[i] = read(), sum += a[i];
sort(a + 1, a + 1 + n, cmp);
length = 1;
while (true)
{
if (sum % length == 0 && dfs(0, 0, 1))
{
printf("%d\n", length);
break;
}
length++;
}
return 0;
}