import java.util.*; import java.io.*; public class No009 { public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(br.readLine()); int[] a=new int[n]; int[] b=new int[n]; StringTokenizer st=new StringTokenizer(br.readLine()); for(int i=0;i q=new PriorityQueue(new my()); for(int nn:a){ q.add(new zako(nn,0)); } max=0; for(int j=i;jmin) break; if(z.times>max) max=z.times; q.add(z); }min=Math.min(min,max); }System.out.println(min); } } class my implements Comparator{ public int compare(Object obj1,Object obj2){ zako z1=(zako)obj1; zako z2=(zako)obj2; if(z1.times+z1.level*100000>z2.times+z2.level*100000){ return 1; }else if(z1.times+z1.level*100000