Minimum Excluded

TarifEzaz BRACU Training Contest
Limits 1s, 512 MB

In a given set of integers, the "mex" or the minimum excluded value is the smallest non-negative integer that is not present in the set. For example, the mex of the set {0,1,2,4} is 3.

In this problem, you will be given a set of numbers, you will have to print the minimum excluded value of that set.

Input

The first line of input contains an integer N, the size of the set.

The next N inputs will have one non-negative integer each, the elements of the set. Each element will appear at most once in the set.

For 10 points, N will be less than or equal to 100 and the elements will be less than or equal to 1000.

For 20 points, N will be less than or equal to 100000 and the elements will be less than or equal to 105.

For 70 points, N will be less than or equal to 100000 and the elements will be less than or equal to 109.

Output

Output one input, the mex value of the given set.

Sample

InputOutput
4
0 1 2 4
3

Submit

Login to submit.

Statistics

57% Solution Ratio
BRACU_1isPrimeEarliest, Feb '20
user.353681Fastest, 0.0s
ProjectDLightest, 131 kB
Jarif_RahmanShortest, 229B
Toph uses cookies. By continuing you agree to our Cookie Policy.