/先统计出所有参赛者积分中比小美分低的人数count,如果人数count >= n - 1,小美最多能到最后一轮(注意题中给出的初始为第0轮),如果count < n - 1,假定每次比赛小美都和比他积分低的人比,统计小美比赛次数,就是小美最多能到的轮数。/

include

using namespace std;

int power(int x){
int n = 0;
while(x >= 2){
x /= 2;
n++;
}
return n;
}

int main(){
int i, n, count, count_1, count_2, pow, ans;
int sorce[1500000];
ans = 0;
count = 0;
cin >> n;
pow = power(n);
for(i = 0; i < n; i++){
cin >> sorce[i];
if(i >= 1){
if(sorce[i] <= sorce[0]){
count++;
}
}
}
if(n == 1)
ans = 0;
else if(count >= n / 2 - 1){
ans = pow - 1;
}
else{
if(count % 2 == 0){
count_2 = 0;
for(i = count; i >= 2; i /= 2)
count_2++;
ans = count_2;
}
else if(count % 2 == 1){
count_1 = 0;
for(i = count + 1; i >= 2; i /= 2)
count_1++;
ans = count_1;
}
}
cout << ans << endl;
return 0;
}