#include <iostream>
#include <math.h>
using namespace std;
int main(){
    int a, b, i1, times, max, min, tyuusinn;
    while(1){
    cin >> a;
    if(a==0){break;}
    i1=0;
    int w[a];
    while(1){
    cin >> b;
    w[i1]=b;
    i1++;
    if(i1==a){break;}
    }
    max=a-1;
    min=0;
    times=0;
    sort(w, w+a);
    cin >> b;
    while(1){
    times++;
        tyuusinn=(max+min)/2;
        if(max==min){break;}
    if(w[tyuusinn]==b){break;}
    else if(w[tyuusinn]<b){
        min=tyuusinn+1;
    }
    else{
        max=tyuusinn-1;
    }
    }
        cout << times << endl;
    }
    return 0;
}