#include <bits/stdc++.h>
using namespace std;

int main(void){
    int n;
    while(cin >> n, n){
        int data[10000];
        int need;
        for(int i=0; i < n; i++)
            cin >> data[i];
        cin >> need;

        int before = 0, after = n-1;
        int cnt = 1;
        while(before < after){
            int mid = (after + before) / 2;
            //cout << "mid 
            if(need == data[mid])
                break;
            cnt++;
            if(data[mid] > need)
                after = mid-1;
            else
                before = mid+1;
        }
        cout << cnt << endl;
    }
    return 0;
}