import java.util.Scanner;
public class Kolikot {
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] arr = new int[n];
for(int i = 0; i < n; i++)
{
arr[i] = scan.nextInt();
}
// int[] arr = {1, 2, 3, 9};
// int n = arr.length;
int k = 1;
while(isSubsetSum1(arr, n, k))
{
if(swch)
{
k += n;
swch = false;
}
else
{
k -= n;
k++;
swch = true;
}
}
System.out.print(k);
}
static boolean isSubsetSum1(int arr[], int n, int sum) {
boolean[][] subset = new boolean[sum + 1][n + 1];
int i, j;
for (i = 0; i <= n; i++) {
subset[0][i] = true;
}
for (i = 1; i <= sum; i++) {
subset[i][0] = false;
}
for (i = 1; i <= sum; i++) {
for (j = 1; j <= n; j++) {
subset[i][j] = subset[i][j - 1];
if (i >= arr[j - 1]) {
subset[i][j] = subset[i][j] || subset[i - arr[j - 1]][j - 1];
}
}
}
return subset[sum][n];
}
}