#include <bits/stdc++.h>using namespace std;int n, weights[1010];int main() { cin >> n; for (int i = 0; i < n; i++) cin >> weights[i]; sort(&weights[0], &weights[n]); int result = 0; for (int i = 0; i < n; i++) { if (weights[i] > result + 1) break; result += weights[i]; } cout << result + 1;}