There are N strings arranged in a row. It is known that, for any two adjacent strings, the string to the left is lexicographically smaller than the string to the right. That is, S_1<S_2<...<S_N holds lexicographically, where S_i is the i-th string from the left.

At least how many different characters are contained in S_1,S_2,...,S_N, if the length of S_i is known to be A_i?

Constraints

* 1 \leq N \leq 2\times 10^5
* 1 \leq A_i \leq 10^9
* A_i is an integer.

Input

Input is given from Standard Input in the following format:


N
A_1 A_2 ... A_N


Output

Print the minimum possible number of different characters contained in the strings.

Examples

Input

3
3 2 1


Output

2


Input

5
2 3 2 1 2


Output

2
#include<cstdio>
const int N=200005;
int n,v[N],l,r,I,a,s[N][2],t;
inline int p1()
{
	for(int i=2;i<=n;++i)
		if(v[i]<=v[i-1])return 0;
	return 1;
}
inline int ck(int x)
{
	t=0;
	for(int i=1;i<=n;++i)if(v[i]<=v[i-1])
	{
		for(;s[t][0]>v[i];--t);
		for(int j=v[i],k=t;;--j,--k)
		{
			if(!j)return 0;
			else if(j!=s[k][0])
			{
				for(int w=t++;w>k;--w)
					s[w+1][0]=s[w][0],s[w+1][1]=s[w][1];
				s[k+1][0]=j,s[k+1][1]=2;break;
			}
			else if(s[k][1]<x){++s[k][1];break;}
			else s[k][1]=1;
		}
	}
	return 1;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",&v[i]);
	if(p1())return printf("1"),0;
	for(l=2,r=n;l<=r;)
		ck(I=l+r>>1)?(a=I,r=I-1):(l=I+1);
	return printf("%d",a),0;
}