#include <iostream>
#include <set>
#include <vector>
int min_sum;
bool hasnt_skipped(std::set<int> &sums) {
int previous = *(sums.begin());
int highest = *(sums.rbegin());
while (previous < highest) {
if (sums.find(previous + 1) != sums.end()) {
previous += 1;
continue;
} else {
min_sum = previous + 1;
return false;
}
}
min_sum = highest + 1;
return true;
}
int main() {
int n;
std::cin >> n;
std::vector<int> coins;
int x;
for(int i = 0; i < n; ++i) {
std::cin >> x;
coins.push_back(x);
}
std::sort(coins.begin(), coins.end());
std::set<int> sofar;
std::vector<int> news;
sofar.insert(0);
for(auto c: coins) {
for(auto s: sofar) {
news.push_back(c + s);
}
for(auto nw: news) {
sofar.insert(nw);
}
news.clear();
bool skip_test;
skip_test = hasnt_skipped(sofar);
if (skip_test == true) {
continue;
} else {
break;
}
}
std::cout << min_sum;
return 0;
}