#include<bits/stdc++.h>
using namespace std;
struct node{
int dep,s;
}sum[1000000];
long long n,a,x=1,y,y2;
int q(int n1){
while(true){
if(x>=n1){
y2=y;
x=1;
y=0;
return y2;
}
x+=x*2;
y++;
}
}
bool cmp(node a,node b){
if(a.s==b.s) return a.dep<b.dep;
return a.s>b.s;
}
int main(){
scanf("%lld",&n);
for(int i=1;i<=n;i++){
scanf("%lld",&a);
sum[q(i)].dep=q(i)+1;
sum[q(i)].s+=a;
}
sort(sum,sum+q(n)+1,cmp);
cout<<sum[0].dep;
return 0;
}