import java.util.Scanner;
public class Main {
public static Scanner sc = new Scanner(System.in);
public static void main(String[] args){
int n = sc.nextInt();
int[] arr = new int[n];
int arrSum = 0;
int arrMin = Integer.MAX_VALUE;
for(int i=0;i<n;i++){
int num = sc.nextInt();
arr[i] = num;
arrSum += num;
if(num < arrMin){
arrMin = num;
}
}
boolean[] dp = new boolean[arrSum + 1 + 1];
dp[0] = true;
for(int i = 0;i< n; i++){
// 使用arr[i], arr[i+1] ...
for(int j=arrSum;j>=arr[i];j--){
dp[j] = dp[j] || dp[j - arr[i]];
}
}
int maxVal = arrMin;
while (dp[maxVal]){
maxVal++;
}
System.out.println(maxVal);
}
}
/*
3
1 2 4
8
3
2 3 9
4
*/