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

int main(){
    int n;
    while(cin >> n, n){
        vector<int> v(n);
        for(int i=0; i < n; i++) cin >> v[i];
        int k; cin >> k;
        int lb = -1, ub = n, count = 0;
        while (ub - lb > 1) {
            int mid = (lb + ub) / 2;
            count++;
            if(v[mid] == k) break;
            if (v[mid] >= k) {
                ub = mid;
            } else {
                lb = mid;
            }
        }
        cout << count << endl;
    }
}