Problem: The currency system in the Kingdom of Yoax-Musty is strange and fairly inefficient. Like other countries, the kingdom has its own currencty unit denoted by K $ (kingdom dollar). However, the Ministry of Finance issues bills for every value between 1 K $ and (231 - 1) K $ worth.

On the other hand, this system often enables people to make many different values just with a small number of bills. For example, if you have four bills of 1 K $, 2 K $, 4 K $, and 8 K $ worth respectively, you can make any values from 1 K #36; to 15 K $.

In this problem, you are requested to write a program that finds the minimum value that cannot be made with a given set (multiset in a mathematical sense) of bills. For the case with the four bills (1 K $, 2 K $, 4 K $, and 8 K $), since you can make any values up to 15 K $, your program should report 16 K $.



Input

The input consists of two lines. The first line contains an integer N (1 ≤ N ≤ 10000), the number of bills. The second line contains N integers, each of which represents the value of a bill in K $. There may be multiple bills of the same value.

Output

Print the minimum value unable to be made on a line. The value should be given in K $ and without any currency sign or name.

Example

Input




Output

Solution (in CPP):

Solution:
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <map>
using namespace std;

#define LL long long
#define ULL unsigned long long
#define LD long double
#define sqr(x) (x)*(x) 
#define M(a,b) (a)>(b)?(a):(b)
const int MAXN = 100010;
const int MAXM = 300010;
const int INF = 0x7fffffff;
const int MOD = 1e9+7;
const double eps = 1e-5;
const double pi=acos(-1.0); 

LL a[100010];
bool cmp(LL x, LL y) {return x < y;};
int main() {
	int n;
	scanf("%d", &n);
	for (int i=1; i<=n; ++i) scanf("%lld", &a[i]);
	sort(a+1, a+1+n, cmp);
	LL ans = 0;
	for (int i=1; i<=n; ++i) {
		if (a[i] <= ans+1) {
			ans += a[i];
		} else break;
	}
	printf("%lld\n", ans+1);
}