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.


-----Examples-----
Input
5
1 3 3 3 6

Output
5

Input
2
2 1

Output
3



-----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.

Source: codeforces | Difficulty: EASY
Tags: Sorting


Solutions:
le = int(input())
n = sorted(map(int, input().split()))
n.sort()
n[0] = 1
for x in range(1, le):
	if n[x] > n[x - 1] + 1:
		n[x] = n[x - 1] + 1
print(n[-1] + 1)


n = int(input())
a = sorted(map(int, input().split()))
ans = 1
for i in range(n):
	if a[i] >= ans:
		ans += 1
print(ans)


n = int(input())
l = [int(i) for i in input().split()]
l.sort()
curr = 1
for i in l:
	if i >= curr:
		curr += 1
print(curr)


n = eval(input())
cur = 1
arr = list(map(int, input().split()))
arr.sort()
for i in range(n):
	if arr[i] >= cur:
		cur += 1
print(cur)


n = int(input())
a = list(map(int, input().split()))
a.sort()
curr = 1
a[0] = 1
for i in range(1, len(a)):
	if a[i - 1] + 1 <= a[i]:
		a[i] = a[i - 1] + 1
print(max(a) + 1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
l = [0] * (n + 1)
k = 1
for i in range(n):
	if a[i] >= k and l[k] == 0:
		l[k] += 1
		k = k + 1
print(k)


n = int(input())
line = list(map(int, input().split()))
line.sort()
rest = 1
for it in line:
	rest += 1 if rest <= it else 0
print(rest)


n = int(input())
l = [int(x) for x in input().split()]
i = 1
l.sort()
for j in range(len(l)):
	if i < l[j]:
		l[j] = i
		i += 1
	elif i == l[j]:
		i += 1
	else:
		pass
print(i)


n = int(input())
a = list(map(int, input().split()))
c = 1
a.sort()
for i in a:
	if i >= c:
		c += 1
print(c)


n = int(input())
a = sorted((int(x) for x in input().split()))
m = 0
for i in range(1, n + 1):
	if i > a[i - 1] + m:
		m = i - a[i - 1]
print(n - m + 1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 1
for i in range(n):
	if ans <= a[i]:
		ans = ans + 1
print(ans)


input()
v = [int(x) for x in input().split(' ')]
v.sort()
cur = 1
for c in v:
	if cur <= c:
		cur += 1
print(cur)


n = int(input())
A = list(map(int, input().split()))
A.sort()
c = 0
for i in range(n):
	if A[i] + c < i + 1:
		c += 1
print(n + 1 - c)


n = int(input())
w = list(map(int, input().split()))
w.sort()
ans = 1
for i in w:
	ans += i >= ans
print(ans)


n = int(input())
mlist = []
ml = input().split(' ')
for i in range(len(ml)):
	mlist.append(int(ml[i]))
mlist.sort()
ans = 1
for i in mlist:
	if i >= ans:
		ans += 1
print(ans)


n = int(input())
a = [int(s) for s in input().split()]
a.sort()
i = 0
j = 1
while i < n:
	if a[i] >= j:
		i += 1
		j += 1
	else:
		i += 1
print(n - i + j)


I = lambda : map(int, input().split())
n = I()
ls = [int(i) for i in input().split()]
ls.sort()
cntr = 1
for i in ls:
	if i >= cntr:
		cntr += 1
print(cntr)


import os
import sys
from io import BytesIO, IOBase

def main():
	n = int(input())
	a = list(map(int, input().split(' ')))
	aa = [x for x in range(1, n + 1)]
	a.sort()
	ans = 1
	for x in range(n):
		if a[x] >= ans:
			ans += 1
		else:
			continue
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


read = lambda : map(int, input().split())
n = int(input())
a = sorted(read())
k = 1
for i in range(n):
	if a[i] > k:
		a[i] = k
		k += 1
	elif a[i] == k:
		k += 1
print(k)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
arr[0] = 1
for i in range(1, n):
	if arr[i] > arr[i - 1]:
		arr[i] = arr[i - 1] + 1
f = 0
for i in range(1, n):
	if arr[i] - arr[i - 1] > 1:
		print(arr[i - 1] + 1)
		f = 1
		break
if f == 0:
	print(arr[-1] + 1)


n = int(input())
a = [int(x) for x in input().split()]
k = 1
a.sort()
for i in range(n):
	if a[i] >= k:
		k += 1
print(k)


n = int(input())
arr = list(map(int, input().split()))
cnt = 1
arr.sort()
for i in range(n):
	if arr[i] >= cnt:
		arr[i] = cnt
		cnt += 1
arr1 = list(set(arr))
t = len(arr1)
print(arr1[t - 1] + 1)


n = int(input())
l = sorted(list(map(int, input().split())))
m = 1
for i in l:
	if i >= m:
		m += 1
print(m)


def arr_inp():
	return [int(x) for x in stdin.readline().split()]
from sys import *
from collections import *
(n, a, pre) = (int(input()), sorted(arr_inp()), 0)
if n == 1:
	print(2)
else:
	for i in range(n):
		if a[i] - pre > 1:
			pre += 1
		else:
			pre = a[i]
	print(pre + 1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
m = a[n - 1]
if True:
	i = 1
	j = 0
	while j < n:
		if a[j] >= i:
			i += 1
		j += 1
	print(i)


n = int(input())
l = list(map(int, input().split()))
l.sort()
res = 1
for i in l:
	if i >= res:
		res += 1
print(res)


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
c = 1
for e in l:
	if e >= c:
		c += 1
print(c)


from sys import *
input = lambda : stdin.readline()
int_arr = lambda : list(map(int, stdin.readline().strip().split()))
str_arr = lambda : list(map(str, stdin.readline().split()))
get_str = lambda : map(str, stdin.readline().strip().split())
get_int = lambda : map(int, stdin.readline().strip().split())
get_float = lambda : map(float, stdin.readline().strip().split())
mod = 1000000007
setrecursionlimit(1000)
n = int(input())
arr = int_arr()
arr.sort()
val = 0
for i in range(n):
	if arr[i] > val:
		val += 1
print(val + 1)


n = int(input())
p = list(map(int, input().split()))
p.sort()
p[0] = 1
for x in range(1, n):
	if p[x] > p[x - 1]:
		p[x] = p[x - 1] + 1
	else:
		pass
print(p[-1] + 1)


n = int(input())
arr = sorted(list(map(int, input().split()))) + [0]
(sim, last, res) = (1, 0, 0)
for i in range(len(arr) - 1):
	if arr[i] == arr[i + 1]:
		sim += 1
	else:
		if last + sim > arr[i]:
			last = arr[i]
		else:
			last += sim
		sim = 1
print(last + 1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
mex = 1
for i in range(len(a)):
	if mex < a[i] or mex == a[i]:
		a[i] = mex
		mex += 1
print(mex)


n = int(input())
m = 1
for i in sorted(map(int, input().split())):
	m += i >= m
print(m)


n = int(input())
lst = list(map(int, input().strip().split(' ')))
lst.sort()
lst[0] = 1
for j in range(1, n):
	if lst[j] >= j + 1:
		if lst[j - 1] == j:
			lst[j] = j + 1
		else:
			lst[j] = lst[j - 1] + 1
	elif lst[j] > lst[j - 1]:
		lst[j] = lst[j - 1] + 1
print(lst[n - 1] + 1)


from sys import stdin as Si, maxsize as m
from math import floor as F
from collections import defaultdict as dt, Counter as Co
from operator import itemgetter as ig
from math import pi
from itertools import product as P
n = int(Si.readline())
L = sorted(list(map(int, Si.readline().split())))
Max = 1
for l in L:
	if l >= Max:
		Max += 1
print(Max)


def main():
	from sys import stdin, stdout
	stdin.readline()
	s = sorted(list(map(int, stdin.readline().split())))
	i = 1
	for j in s:
		if i <= j:
			i += 1
	stdout.write(str(i))
main()


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
arr[0] = 1
for i in range(1, n):
	arr[i] = min(arr[i], arr[i - 1] + 1)
print(arr[-1] + 1)


t = int(input())
l = list(map(int, input().split()))
x = 1
l.sort()
for i in l:
	if i >= x:
		x += 1
print(x)


n = int(input())
mex = 1
for num in sorted(map(int, input().split())):
	if num >= mex:
		mex += 1
print(mex)


N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 1
for a in A:
	if a >= ans:
		ans += 1
print(ans)


n = int(input())
c = list(map(int, input().split()))
c.sort()
m = 1
for i in range(n):
	if m <= c[i]:
		c[i] = m
		m += 1
print(m)


import sys
import bisect
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 1
for i in l:
	if i >= ans:
		ans += 1
print(ans)


n = int(input())
lst = list(map(int, input().split()))
lst.sort()
k = 1
for (i, x) in enumerate(lst):
	if x >= k:
		lst[i] = k
		k += 1
print(lst[-1] + 1)


def get_ints():
	return list(map(int, input().split()))

def main():
	n = int(input())
	a = get_ints()
	a.sort()
	r = 1
	i = 0
	while i < n:
		if a[i] >= r:
			r += 1
		i += 1
	print(r)
main()


n = int(input())
given_list = list(map(int, input().split()))
given_list.sort()
given_list[0] = 1
for i in range(1, n):
	if given_list[i] > given_list[i - 1]:
		if given_list[i - 1] < i:
			given_list[i] = given_list[i - 1] + 1
		elif given_list[i] > i + 1:
			given_list[i] = i + 1
print(given_list[-1] + 1)


stack = []
amount = int(input())
array = [int(x) for x in input().split(' ')]
array.sort()
for nr in array:
	if int(nr) > len(stack):
		stack.append(1)
print(len(stack) + 1)


n = int(input())
nombres = list(map(int, input().split()))
nombres.sort()
i = 0
entierSuivant = 1
while i != n:
	if nombres[i] > entierSuivant:
		nombres[i] = entierSuivant
		entierSuivant += 1
	elif entierSuivant == nombres[i]:
		entierSuivant += 1
	i += 1
print(entierSuivant)


i = int(input())
l = sorted(list(map(int, input().split())))
c = x = la = 0
for t in l:
	c += t - la
	if c > 0:
		x += 1
		c -= 1
	la = t
print(x + 1)


n = int(input())
nums = list(map(int, input().split()))
nums.sort()
nums[0] = 1
for i in range(n - 1):
	if nums[i + 1] - nums[i] > 1:
		nums[i + 1] = nums[i] + 1
print(nums[-1] + 1)


nn = int(input())
a = list(map(int, input().split()))
a.sort()
k = 1
for x in a:
	if x >= k:
		k += 1
print(k)


n = int(input())
l = list(map(int, input().split()))
l.sort()
an = 1
for i in range(n):
	if an <= l[i]:
		an += 1
print(an)


n = int(input())
ar = list(map(int, input().split()))
ar = sorted(ar)
ele = 1
for i in range(n):
	if ar[i] >= ele:
		ele += 1
print(ele)


def main():
	input()
	l = list(map(int, input().split()))
	l.sort()
	a = 0
	for b in l:
		if b > a + 1:
			a += 1
		else:
			a = b
	print(a + 1)
main()


t = int(input())
l = []
l.extend(map(int, input().split()))
l.sort()
ans = 1
for i in range(len(l)):
	if ans <= l[i]:
		ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
a.sort()
P = 1
for i in range(n):
	if a[i] >= P:
		a[i] = P
		P += 1
	else:
		continue
print(max(a) + 1)


input()
i = 0
for j in sorted(map(int, input().split())):
	i += i < j
print(i + 1)


n = int(input())
mex = 1
a = list(map(int, input().split()))
a = sorted(a)
for i in range(n):
	if int(a[i]) >= mex:
		mex += 1
print(mex)


n = int(input())
l = list(map(int, input().split()))
l.sort()
count = 1
for k in range(n):
	if l[k] >= count:
		count += 1
print(str(count))


a = int(input())
b = sorted(map(int, input().split()))
w = 1
for i in range(len(b)):
	if b[i] >= w:
		w += 1
print(w)


n = int(input())
li = list(map(int, input().split()))
li.sort()
cur = 1
for i in range(n):
	if li[i] >= cur:
		cur += 1
print(cur)


input()
mex = 1
for a in sorted(map(int, input().split())):
	mex += a >= mex
print(mex)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
mex = 1
for i in range(n):
	if arr[i] >= mex:
		arr[i] = mex
		mex = mex + 1
print(mex)


n = int(input())
a = list(map(int, input().split()))
mex = 1
a.sort()
for num in a:
	if num >= mex:
		mex = mex + 1
print(mex)


n = input()
ls = sorted([int(i) for i in input().split()])
cntr = 1
for i in ls:
	if i >= cntr:
		cntr += 1
print(cntr)


t = int(input())
a = input()
a = a.split()
for i in range(len(a)):
	a[i] = int(a[i])
a.sort()
q = 1
for i in range(t):
	if a[i] >= q:
		a[i] = q
		q += 1
print(q)


from collections import defaultdict, deque, Counter, OrderedDict

def main():
	n = int(input())
	l = sorted([int(i) for i in input().split()])
	c = 1
	for i in l:
		if i >= c:
			c += 1
	print(c)

def __starting_point():
	main()
__starting_point()


n = input()
y = 1
for x in sorted(map(int, input().split())):
	if x >= y:
		y += 1
print(y)


input()
mex = 1
numbers = sorted(map(int, input().split()))
for number in numbers:
	if mex <= number:
		mex += 1
print(mex)


n = int(input())
s = [int(j) for j in input().split()]
s.sort()
if n != 1:
	max_ = 0
	s[0] = 1
	for i in range(1, n):
		if s[i] >= s[i - 1] + 1:
			s[i] = s[i - 1] + 1
		max_ = s[n - 1]
	print(max_ + 1)
else:
	s[0] = 1
	print(s[0] + 1)


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from operator import add
inf = float('inf')
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
n = ii()
arr = rr()
arr.sort()
m = 0
for i in range(n):
	if arr[i] > m:
		m += 1
print(m + 1)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
cur = 1
for i in range(n):
	if a[i] >= cur:
		cur += 1
print(cur)


n = int(input())
a = list(map(int, input().split()))
l = 1
a = sorted(a)
for i in range(len(a)):
	if a[i] >= l:
		a[i] = l
		l += 1
print(max(a) + 1)


import sys
import math
import bisect

def solve(A):
	n = len(A)
	A.sort()
	mex = 1
	for i in range(n):
		if A[i] >= mex:
			mex += 1
	return mex

def main():
	n = int(input())
	A = list(map(int, input().split()))
	ans = solve(A)
	print(ans)
main()


n = input()
n = int(n)
a = input()
a = a.split()
for i in range(0, n):
	a[i] = int(a[i])
a.sort()
ans = 1
for i in range(0, n):
	if a[i] >= ans:
		ans += 1
print(ans)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
now = 1
for i in range(len(arr)):
	if arr[i] >= now:
		now += 1
print(now)


input()
a = sorted(list(map(int, input().split())))
b = []
for item in a:
	if b == []:
		b.append(1)
	elif b[-1] < item:
		b.append(b[-1] + 1)
print(b[-1] + 1)


n = int(input())
li = list(map(int, input().split()))
li = sorted(li)
temp = 1
for i in range(n):
	if li[i] >= temp:
		temp += 1
print(temp)


N = int(input())
A = list(map(int, input().split()))
A.sort()
now = 0
for i in range(N):
	if A[i] > now:
		now += 1
		A[i] = now
	elif A[i] == now:
		continue
print(A[-1] + 1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
ma = 0
for i in range(n):
	if a[i] >= ma + 1:
		ma += 1
print(ma + 1)


from collections import Counter
try:
	while True:
		n = int(input())
		a = sorted(map(int, input().split()))
		t = 1
		for x in a:
			t = min(t, x) + 1
		print(t)
except EOFError:
	pass


input()
mex = 1
a = list(map(int, input().split()))
a.sort()
for ai in a:
	if ai >= mex:
		mex = mex + 1
print(mex)


n = int(input())
a = list(map(int, input().split()))
a.sort()
cur = 1
for ele in a:
	if ele >= cur:
		cur += 1
print(cur)


input()
m = 1
for i in sorted(map(int, input().split())):
	if i >= m:
		m += 1
print(m)


n = int(input())
L = sorted([int(i) for i in input().split()])
i = 0
mex = 1
while i < n:
	if mex <= L[i]:
		mex += 1
	i += 1
print(mex)


import sys
n = int(input())
inp = input()
numbers = [int(x) for x in inp.split()]
numbers.sort()
temp = 1
for i in range(0, n):
	if numbers[i] >= temp:
		temp += 1
print(temp)


n = int(input())
tab = sorted(list(map(int, input().split())))
cmex = 1
for num in tab:
	if num >= cmex:
		cmex += 1
print(cmex)


import time
n = int(input())
a = [int(i) for i in input().split()]
start = time.time()
a = sorted(a)
now = 1
for i in range(n):
	if a[i] >= now:
		a[i] = now
		now = now + 1
print(now)
finish = time.time()


n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = n + 1
i = 0
j = 1
while i < n:
	if a[i] >= j:
		i += 1
		j += 1
	else:
		while i < n and a[i] < j:
			i += 1
		if i != n:
			j += 1
			i += 1
print(j)


n = int(input())
ip = list(map(int, input().split()))
ip = sorted(ip)
i = 0
j = 1
while i < n:
	if ip[i] >= j:
		i += 1
		j += 1
	else:
		i += 1
print(j)


__author__ = 'aste'

def main():
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	i = 0
	current = 1
	while i < n:
		if a[i] >= current:
			a[i] = current
			current += 1
		else:
			a[i] = current - 1
		i += 1
	print(current)
main()


n = int(input())
a = sorted([int(x) for x in input().split()])
flag = True
a[0] = 1
for i in range(1, n):
	if a[i] > a[i - 1]:
		a[i] = a[i - 1] + 1
for i in range(1, n):
	if a[i] - a[i - 1] > 1:
		print(a[i - 1] + 1)
		flag = False
		break
if flag:
	print(a[n - 1] + 1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
mex = 1
delta = 0
previous = 0
for i in a:
	delta += i - previous
	previous = i
	if delta > 0:
		delta -= 1
		mex += 1
print(mex)


n = int(input())
array = sorted(list(map(int, input().split())))
ref = 1
for i in range(n):
	if array[i] >= ref:
		ref += 1
print(ref)


def read(type=int):
	return type(input())

def read_arr(type=int):
	return [type(token) for token in input().split()]

def solution(a, b, c, A, B):
	A.sort()
	B.sort()
	aa = min(a, len(A))
	bb = min(b, len(B))
	s = 0
	for i in range(aa):
		s += A[i]
	for i in range(bb):
		s += B[i]

def run():
	n = read()
	A = read_arr()
	A.sort()
	B = [i for i in range(1, n + 1)]
	cnt = 0
	j = 1
	for i in range(n):
		if A[i] < j:
			cnt += 1
		else:
			j += 1
	print(n + 1 - cnt)
run()


n = int(input())
rs = 1
for i in sorted(map(int, input().split())):
	rs += i >= rs
print(rs)


import sys
input = lambda : sys.stdin.readline()
int_arr = lambda : list(map(int, input().split()))
str_arr = lambda : list(map(str, input().split()))
get_str = lambda : map(str, input().split())
get_int = lambda : map(int, input().split())
get_flo = lambda : map(float, input().split())
mod = 1000000007

def solve(n, arr):
	arr.sort()
	e = 1
	for i in range(n):
		if arr[i] > e:
			arr[i] = e
			e += 1
		if arr[i] == e:
			e += 1
	print(arr[-1] + 1)
n = int(input())
arr = int_arr()
solve(n, arr)


n = int(input())
l = sorted(map(int, input().split()))
ans = 2
l[0] = 1
for i in range(1, n):
	if l[i] > l[i - 1]:
		l[i] = l[i - 1] + 1
		ans = l[i] + 1
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
temp = 1
for i in a:
	if i >= temp:
		temp += 1
print(temp)


n = int(input())
a = [int(x) for x in input().split()]
if n == 1:
	print(2)
else:
	a.sort()
	largestsofar = 1
	postocheck = 1
	done = False
	while not done:
		while postocheck < len(a) and a[postocheck] <= largestsofar:
			postocheck += 1
		if postocheck == len(a):
			print(largestsofar + 1)
			done = True
		else:
			largestsofar += 1
			postocheck += 1


import sys
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 1
cur = 1
i = 0
while i < n:
	if l[i] >= cur:
		cur += 1
	i += 1
print(cur)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict
from math import ceil, floor, sqrt, log2, gcd, pi
from heapq import heappush, heappop
from bisect import bisect_left, bisect
import sys
abc = 'abcdefghijklmnopqrstuvwxyz'
ABC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
dp = []
ans = []
for i in range(1, n + 1):
	dp.append(i)
ans.append(1)
for i in range(1, n):
	ans.append(min(arr[i], ans[i - 1] + 1))
print(max(ans) + 1)


n = int(input())
arr = [int(i) for i in input().split()]
arr.sort()
arr[0] = 1
for i in range(1, n):
	if arr[i] >= arr[i - 1] + 1:
		arr[i] = arr[i - 1] + 1
print(arr[n - 1] + 1)


import sys

def minp():
	return sys.stdin.readline().strip()
n = int(minp())
k = 0
for i in sorted(map(int, minp().split())):
	if i >= k + 1:
		k += 1
print(k + 1)


a = int(input())
arr = list(map(int, input().split()))
m = 1
for i in sorted(arr):
	m += i >= m
print(m)


n = int(input())
A = [int(x) for x in input().split()]
A.sort()
mex = 1
for i in range(n):
	if A[i] >= mex:
		A[i] = mex
		mex += 1
print(mex)


from sys import stdin

def parse():
	N = int(stdin.readline().strip())
	A = map(int, stdin.readline().split())
	A = sorted(A)
	k = 0
	for item in A:
		assert k <= item
		if k < item:
			k += 1
	print(k + 1)
parse()


a = input()
a = int(a)
x = list(map(int, input().split()))
x.sort()
num = 1
for i in x:
	if i >= num:
		num = num + 1
print(num)


n = int(input())
a = sorted(map(int, input().split()))
result = 1
for item in a:
	if item >= result:
		result += 1
print(result)


def check(a, x):
	want = 1
	for i in range(len(a)):
		if a[i] > want:
			want = want + 1
	if want + 1 >= x:
		return True
	return False
n = int(input())
a = list(map(int, input().split()))
a.sort()
(lo, hi) = (2, n + 1)
while lo < hi:
	md = int((lo + hi + 1) / 2)
	if check(a, md) == True:
		lo = md
	else:
		hi = md - 1
print(lo)


import sys
import math
import random
if len(sys.argv) >= 2:
	if sys.argv[1] == 'LOCAL':
		sys.stdin = open('input.in', 'r')
n = int(input())
l = map(int, input().split())
l = sorted(l)
mex = 1
for i in l:
	if i >= mex:
		mex += 1
print(mex)


n = int(input())
a = list(map(int, input().split()))
a.sort()
m = 1
for x in a:
	if x >= m:
		m += 1
print(m)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
i = 1
j = 0
while j < n:
	while i > a[j]:
		j += 1
		if j == n:
			print(i)
			exit(0)
	j += 1
	i += 1
print(i)


n = int(input())
a = list(map(int, input().split()))
a_sort = sorted(a, key=int)
j = 1
for i in range(n):
	if a_sort[i] >= j:
		j += 1
print(j)


input()
r = 1
for e in sorted(map(int, input().split())):
	r += e >= r
print(r)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
hole = 1
for i in range(len(a)):
	if a[i] >= hole:
		hole += 1
print(hole)


n = int(input())
arr1 = list(map(int, input().split()))
arr1.sort()
count = 1
for i in range(n):
	if arr1[i] >= count:
		count += 1
print(count)


n = int(input())
array = sorted(map(int, input().split()))
result = 1
for x in array:
	if x >= result:
		result += 1
print(result)


n = int(input())
ai = list(map(int, input().split()))
ai.sort()
num = n
ans = 0
for i in ai:
	num -= 1
	ans += 1
	ans = min(i, ans)
print(ans + 1)


n = int(input())
a = sorted(map(int, input().split()))
mex = 1
for i in range(0, len(a)):
	if a[i] >= mex:
		mex = mex + 1
print(mex)


ll = lambda : list(map(int, input().split()))
st = lambda : input()
v = lambda : map(int, input().split())
ii = lambda : int(input())
from collections import *
from math import *
from datetime import datetime
x = ii()
y = ll()
c = 1
y.sort()
for i in y:
	if i >= c:
		c += 1
print(c)


n = int(input())
a = list(map(int, input().split()))
a.sort()
res = 1
for i in a:
	res += i >= res
print(res)


n = int(input())
arr = [int(x) for x in input().split(' ')]
arr = sorted(arr)
i = 1
for j in arr:
	if j >= i:
		i += 1
print(i)


IL = lambda : list(map(int, input().split()))
IS = lambda : input().split()
I = lambda : int(input())
S = lambda : input()
n = I()
a = IL()
a = sorted(a)
mex = 1
for i in range(n):
	if a[i] >= mex:
		mex += 1
print(mex)


n = int(input())
L = list(map(int, input().split()))
L.sort()
val = 0
for x in L:
	val = min(val + 1, x)
print(val + 1)


n = int(input())
a = sorted(map(int, input().split()))
mex = 1
for v in a:
	if v >= mex:
		mex = mex + 1
print(mex)


N = int(input())
(X, Number) = (sorted(list(map(int, input().split()))), 1)
for i in X:
	if i >= Number:
		Number += 1
print(Number)


n = int(input())
d = list(map(int, input().split()))
d.sort()
ans = 1
for x in d:
	if x >= ans:
		ans += 1
print(ans)


(n, a, w) = (int(input()), sorted(map(int, input().split())), 1)
for i in a:
	if i >= w:
		w += 1
print(w)


input()
res = 1
for e in sorted(map(int, input().split())):
	res += e >= res
print(res)


n = int(input())
a = list(map(int, input().split()))
flag = 0
z = 1
c = 1
a.sort()
for i in range(0, n):
	if a[i] >= z:
		a[i] = z
		z = z + 1
if z <= n:
	a1 = set(a)
	a2 = list(a1)
	print(a2[len(a2) - 1] + 1)
else:
	print(n + 1)


n = int(input())
temp = 1
for number in sorted(map(int, input().split())):
	if number >= temp:
		temp += 1
print(temp)


import sys
n = int(input())
z = list(map(int, input().split()))
z.sort()
last = 0
for i in range(n):
	if z[i] - last >= 2:
		z[i] = last + 1
		last += 1
	else:
		last = z[i]
print(z[-1] + 1)


tam = int(input())
lista = list(map(int, input().split()))
lista.sort()
cont = 1
for i in lista:
	if cont <= i:
		cont += 1
print(cont)


import sys

def main():
	n = int(sys.stdin.readline())
	x = list(map(int, sys.stdin.readline().split()))
	x.sort()
	c = 1
	for i in range(n):
		if x[i] >= c:
			c += 1
	print(c)
main()


from sys import stdin
n = int(stdin.readline().strip())
s = list(map(int, stdin.readline().strip().split()))
s.sort()
x = 1
for i in range(n):
	if s[i] >= x:
		x += 1
print(x)


import sys
input = sys.stdin.readline
import math

def main():
	n = int(input())
	tab = list(map(int, input().split()))
	tab.sort()
	inc = 0
	for x in range(n):
		if tab[x] > inc:
			inc += 1
	print(inc + 1)
main()


n = int(input())
c = 1
for v in sorted(list(map(int, input().split()))):
	if v >= c:
		c += 1
print(c)


import sys
sys.stdin.readline()
s = sorted(list((int(x) for x in sys.stdin.readline().split())))
cur = 1
for x in s:
	if x >= cur:
		cur += 1
print(cur)


import sys
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
ans = 1
for i in range(1, n + 1):
	if arr[i - 1] >= ans:
		ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
count = 1
for i in sorted(a):
	if i >= count:
		count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
a.sort()
mex = 1
miss = False
i = 0
while i < n:
	while i < n and a[i] < mex:
		i += 1
	if i != n:
		mex += 1
	i += 1
print(mex)


a = int(input())
b = [int(i) for i in input().split()]
c = sorted(b)
j = 2
c[0] = 1
for i in range(1, len(c)):
	if c[i] > j:
		c[i] = j
		j = j + 1
	elif c[i] == c[i - 1]:
		continue
	elif c[i] == j:
		j = j + 1
if len(c) == 1:
	print(2)
else:
	print(max(c) + 1)


n = int(input())
l = list(map(int, input().split()))
l.sort()
d = set()
l[0] = 1
for i in range(1, n):
	l[i] = min(l[i - 1] + 1, l[i])
print(l[n - 1] + 1)


n = int(input())
x = sorted(list(map(int, input().split())))
ans = 1
for i in range(n):
	if x[i] >= ans:
		ans += 1
print(ans)


n = int(input())
l_n = list(map(int, input().split()))
l_n.sort()
c = 1
for n in l_n:
	if c <= n:
		c += 1
print(c)


n = int(input())
l = list(map(int, input().split()))
p = 1
c = 0
l = sorted(l)
for i in range(n):
	if p > l[i]:
		c = 1
	else:
		p = p + 1
print(p)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	a[0] = 1
	for i in range(1, n):
		if a[i] > a[i - 1]:
			a[i] = a[i - 1] + 1
	print(a[-1] + 1)
main()


n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(n):
	if i and a[i - 1] != a[i]:
		a[i] = a[i - 1] + 1
	elif not i:
		a[i] = 1
mex = 0
for i in range(n):
	if i != n - 1 and a[i + 1] > a[i] + 1:
		mex = a[i] + 1
		break
else:
	mex = a[n - 1] + 1
print(mex)


n = int(input())
s = sorted(list(map(int, input().split())))
count = 1
for k in range(n):
	if s[k] >= count:
		count += 1
print(count)


n = int(input())
l = list(map(int, input().rstrip().split(' ')))
l.sort()
start = 0
for i in range(n):
	if l[i] - start > 1:
		l[i] = start + 1
	start = l[i]
print(start + 1)


n = int(input())
A = list(map(int, input().split()))
A.sort()
mex = 1
for x in A:
	if x >= mex:
		mex += 1
print(mex)


n = int(input())
nums = sorted((int(_) for _ in input().split()))
i = 0
while i < len(nums):
	if nums[i] <= i:
		nums.pop(i)
	else:
		i += 1
print(len(nums) + 1)


n = int(input())
a = sorted(list(map(int, input().split())))
b = []
m = 1
for i in a:
	if i >= m:
		b.append(m)
		m += 1
print(m)


n = int(input())
data = sorted(list(map(int, input().split())))
min1 = 10 ** 9 + 1
for i in range(n):
	data[i] = min(data[i], i + 1, min1)
	min1 = data[i] + 1
print(data[-1] + 1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
a[0] = 1
if n == 1:
	print(2)
	exit()
for i in range(1, n):
	a[i] = min(a[i - 1] + 1, a[i])
print(max(a) + 1)


input()
al = list(map(int, input().split()))
al.sort()
cur = 1
for a in al:
	if cur <= a:
		cur += 1
print(cur)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
temp = 1
for i in range(n):
	if a[i] != temp and a[i] > temp:
		a[i] = temp
		temp += 1
	elif a[i] == temp:
		temp += 1
print(a[n - 1] + 1)


n = int(input())
a = sorted(list(map(int, input().split())))
f = 0
ans = 1
for i in range(0, len(a)):
	if a[i] >= ans:
		ans += 1
print(ans)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def main():
	n = I()
	a = sorted(LI())
	r = 1
	for c in a:
		if c >= r:
			r += 1
	return r
print(main())


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
num = 1
i = 0
while i < n:
	if i < n and num <= a[i]:
		num += 1
	i += 1
print(num)


n = int(input())
li = list(map(int, input().split()))
li = sorted(li)
ans = 1
for i in li:
	if i >= ans:
		ans += 1
print(ans)


n = int(input())
a = sorted(map(int, input().split()))
b = list(range(1, n + 1))
t = 0
for x in range(n):
	if a[x] > b[x] + t:
		a[x] = b[x] + t
	elif a[x] < b[x] + t:
		t -= 1
print(max(a) + 1)