#include <cstdio>
#include <iostream>
#include <cmath>
using namespace std;
int num[100005] = {0};
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
        scanf("%d", &num[i]);
    int ans = 1, k = 1, max = -0x3f3f3f3f;
    int x = log(n + 1) / log(2); //完全二叉树的层数
    for (int i = 1; i <= x; i++) //层数
    {
        int sum = 0;
        for (int j = 0; j < pow(2, i - 1); j++) //每层的节点个数
            sum += num[k++];                    //每层节点的权值
        if (sum > max)
        {
            max = sum;
            ans = i;
        }
    }
    printf("%d\n", ans);
    system("pause");
    return 0;
}
