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>
#define Z int
#define S(n) scanf("%d",&n)
#define P(n) printf("%d",n)
#define F(i,a,b) for(Z i=a;i<=b;i++)
#define W while
#define sm(a,b) ((a)<(b)?(a):(b))
#define I if
#define E else
#define B break
#define R return
#define nx 200001
Z n,l,r,m,a[nx],no=0,inf=2e6;
Z num[nx],len[nx],t,dec,d,zr;
Z pw(Z x,Z y){
	Z s=1;
	W(y&&s<inf/x)s*=x,y--;
	R y?inf:s;
}
Z check(Z m){
	num[0]=num[t=1]=0,len[1]=a[1];
	F(i,2,n)I(a[i]>a[i-1])num[++t]=0,len[t]=a[i]-a[i-1];E{
		dec=a[i-1]-a[i];
		W(dec){
			W(num[t]&&dec)dec--,num[t]/=m,len[t]--,t-=!len[t];
			I(dec)d=sm(dec,len[t]),dec-=d,len[t]-=d,t-=!len[t];
		}
		num[t]++,zr=0;
		W(t&&num[t]==(d=pw(m,len[t])))zr+=len[t--],num[t]++;
		I(zr)num[++t]=0,len[t]=zr;
		I(num[0])R 0;
	}
	R 1;
}
Z main(){
	S(n);
	F(i,1,n)S(a[i]),no|=a[i]<=a[i-1];
	I(!no){P(1);R 0;}
	l=2,r=2e9;
	W(r-l>1)m=l+r>>1,check(m)?r=m:l=m;
	P(check(l)?l:l+1);
}