枚举每一层的和
#include<iostream>
#include<cmath>
using namespace std;
const int N = 100010;
const long long INF = -10e10 - 1;
int a[N];
int main(){
int n ;
cin >> n;
long long summ = INF, res = 0;
for(int i = 1; i <= n; i ++){
cin >> a[i];
}
int t = n, k = 0;
while(t){
t /= 2;
k ++;
}
for(int i = 0; i < k; i ++){
long long sum = 0;
for(int j = pow(2, i); j <= pow(2, i + 1) - 1 && j <= n; j ++){
sum += a[j];
}
if(sum > summ){
res = i + 1;
summ = sum;
}
}
cout << res << endl;
return 0;
}