#include <iostream>
using namespace std;
const int N = 10010;
long long s[N];
int n;
int main() {
cin >> n;
long long tmp;
int depth = 1;
int t = 1;
int target_num = 1;
for(int i = 1; i <= n; i ++) {
cin >> tmp;
s[depth] += tmp;
if(i >= target_num) {
t *= 2;
target_num += t;
depth += 1;
}
}
int res = 1;
for(int i = 1; s[i] != 0; i ++)
if(s[res] < s[i])
res = i;
printf("%lld", res);
return 0;
}