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<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<map>
using namespace std;
int aa[201000];
int lst[201000];
int n;
bool jud(int x)
{
	if(x==2)
		int oop=-1;
	int i;
	map<int,int>mp;
	for(i=1;i<=n;i++)
	{
		if(aa[i]<=aa[i-1])
		{
			while(!mp.empty())
			{
				int t=mp.rbegin()->first;
				if(t>aa[i])mp.erase(t);
				else break;
			}
			int j=aa[i];
			while(mp[j]+1==x)mp.erase(j),j--;
			if(j==0)return 0;
			mp[j]++;
		}
	}
	return 1;
}
void erfen()
{
	int ll=2,rr=n,mid;
	while(ll<rr)
	{
		mid=(ll+rr)/2;
		if(jud(mid))rr=mid;
		else ll=mid+1;
	}
	printf("%d\n",ll);
}
int main()
{
	int i;
	scanf("%d",&n);
	bool ppp=0;
	for(i=1;i<=n;i++)
	{
		scanf("%d",&aa[i]);
		if(aa[i]<=aa[i-1])ppp=1;
	}
	if(ppp==0){printf("1\n");return 0;}
	erfen();
	return 0;
}