eolymp
bolt
Try our new interface for solving problems
Problems

Not representable number

Not representable number

Given n positive integers. Find the minimum positive integer that is not representable as the sum of any of these numbers. Each original number cannot be included to the sum more than once.

Input

The first line contains the number n (1n10000), each of the following n lines contains one natural number if the range from 1 to 109.

Output

Print the minimum not representable number.

Time limit 1 second
Memory limit 128 MiB
Input example #1
4
1
1
1
5
Output example #1
4