The smallest number#5726

The smallest number

1 second
32 megabytes
Easy

Given a sorted list of natural numbers A_1 < \ldots < A_N.

Your task is to find the smallest natural number that cannot be expressed as the sum of any subset of numbers from this list. You may use each number from the list at most once, and the sum can be composed of just one number.

Input

The first line contains a single integer (1 \leq N \leq 10^6)—the number of elements in the list. The second line contains the elements of the list, separated by spaces. All elements are distinct natural numbers, sorted in increasing order, and each does not exceed 10^6.

The input data is guaranteed to be correct.

Output

Output a single integer—the smallest natural number that cannot be formed as described.

Examples

Example 1

Loading
Loading