#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
    int n,m;
    while(cin >> n && n) {
        vector<int> v(n);
        for(int i = 0; i < n; i++) 
            cin >> v[i];

        cin >> m;
        sort(v.begin(), v.end());

        int lb, ub, cnt;
        lb = 0; ub = v.size() - 1;
        cnt = 0;
        while(lb <= ub) {
            int mb = (lb + ub) / 2;
            cnt++;
            if(v[mb] < m) {
                lb = mb + 1;
            } else if(v[mb] == m) {
                break;
            } else {
                ub = mb - 1;
            }
        }
        cout << cnt << endl;
    }
}