#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int n;
    while(cin >> n, n){
        int data[105];
        rep(i,n){
            cin >> data[i];
        }
        int ans = 0, search;
        cin >> search;
        int start = 0, end = n - 1;
        int p;
        while(end >= start){
            p = (end + start) / 2;
            ans++;
            if(search > data[p])
                start = p + 1;
            else if(search < data[p])
                end = p - 1;
            else
                break;
        }
        cout << ans << endl;
    }
}