import std.stdio, std.string, std.conv;long n,k,f,y,m=1;void main(){readf("%d\n",&n);auto A=readln.split.to!(long[])~1;long*u=&A.dup[0],v=&A.dup[0];while(n-m>1){k=(m+n)/2;*u=*v=0;foreach(a;A){if(*u<a)*++u=a,*++v=1;else{while(*--u>=a){y=*v;while(--*(u+1)>=*u&&y)--y/=k;*--v+=y;}if(*++u>a){while(--*u>=a&&*v)--*v/=k;*u=a,++*v;}++f,++*v;}}*v-->k+1?m:n=k;--f,--u;}writeln(f?n:1);}