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

vector<int> data;
int bsearch(int n) {
    int count = 0;
    int l = 0, r = data.size();
    int mid = 0, prev_mid;
    while (true) {
        prev_mid = mid;
        mid = (l + r) / 2;
        if (prev_mid == mid) break;
        count++;
        if (data[mid] < n) {
            l = mid;
        } else if (data[mid] == n) {
            return count;
        } else {
            r = mid;
        }
    }
    return count;
}

int main() {
    int n;
    while (cin >> n) {
        data.clear();
        if (n == 0) break;
        for (int i = 0; i < n; i++) {
            int t; cin >> t;
            data.push_back(t);
        }
        int find_n; cin >> find_n;
        cout << bsearch(find_n) << endl;
    }
    return 0;
}