Codeforces Round 358 (Div. 2)
B
Alyona and Mex
Codeforces
1200
原题
← AC →
翻译中…

Someone gave Alyona an array containing $*n*$ positive integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$. In one operation, Alyona can choose any element of the array and decrease it, i.e. replace with any positive integer that is smaller than the current one. Alyona can repeat this operation as many times as she wants. In particular, she may not apply any operation to the array at all.

翻译中…

Formally, after applying some operations Alyona will get an array of $*n*$ positive integers $*b*_{1}, *b*_{2}, ..., *b*_{*n*}$ such that $1 ≤ *b*_{*i*} ≤ *a*_{*i*}$ for every $1 ≤ *i* ≤ *n*$. Your task is to determine the maximum possible value of mex of this array.

翻译中…

Mex of an array in this problem is the minimum positive integer that doesn't appear in this array. For example, mex of the array containing $1$, $3$ and $4$ is equal to $2$, while mex of the array containing $2$, $3$ and $2$ is equal to $1$.

翻译中…

Input

翻译中…

The first line of the input contains a single integer $*n*$ ($1 ≤ *n* ≤ 100 000$) — the number of elements in the Alyona's array.

翻译中…

The second line of the input contains $*n*$ integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ ($1 ≤ *a*_{*i*} ≤ 10^{9}$) — the elements of the array.

翻译中…

Output

翻译中…

Print one positive integer — the maximum possible value of mex of the array after Alyona applies some (possibly none) operations.

翻译中…

Note

翻译中…

In the first sample case if one will decrease the second element value to $2$ and the fifth element value to $4$ then the mex value of resulting array $1$ $2$ $3$ $3$ $4$ will be equal to $5$.

翻译中…

To reach the answer to the second sample case one must not decrease any of the array elements.

翻译中…

样例

Input #1
5
1 3 3 3 6
Output #1
5
InputCopy OutputCopy
Input #2
2
2 1
Output #2
3
InputCopy OutputCopy
题目信息
题号
682B
时间限制
1 s
内存限制
256 MB
标签
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。