#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<int> x(n);
        for(int i=0; i<n; ++i)
            cin >> x[i];
        int y;
        cin >> y;

        int ret = 0;
        int a = 0;
        int b = n-1;
        while(a <= b){
            int c = (a + b) / 2;
            ++ ret;
            if(x[c] == y)
                break;
            if(x[c] < y)
                a = c + 1;
            else
                b = c - 1;
        }

        cout << ret << endl;
    }
}