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 <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

const int N=2e5+5;
int n,top,a[N];
struct Node {int pos,tot;} sta[N];

template <typename _Tp> inline void IN(_Tp&x) {
	char ch;bool flag=0;x=0;
	while(ch=getchar(),!isdigit(ch)) if(ch=='-') flag=1;
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	if(flag) x=-x;
}

void solve(int pos,int mid) {
	while(sta[top].pos>pos) --top;
	if(sta[top].pos==pos) ++sta[top].tot;
	else sta[++top]=(Node){pos,1};
	if(top>1&&sta[top].tot==mid) --top,solve(pos-1,mid);
}
inline bool check(int mid) {
	sta[top=1]=(Node){0,0};
	for(int i=2;i<=n;++i) if(a[i]<=a[i-1]) solve(a[i],mid);
	return sta[1].tot==0;
}

int main() {
	IN(n);
	bool flag=true;
	for(int i=1;i<=n;++i) IN(a[i]);
	for(int i=2;i<=n;++i) flag&=(a[i]>a[i-1]);
	if(flag) return puts("1"),0;
	int l=2,r=n,mid,ans=n;
	while(l<=r) check(mid=l+r>>1)?ans=mid,r=mid-1:l=mid+1;
	printf("%d\n",ans);
	return 0;
}