#include <iostream>
using namespace std;

int search(int a[], int n, int k) {
    int count = 0;
    int l = 0, r = n - 1;
    while (l <= r) {
        count++;
        int m = (l + r) / 2;
        if (a[m] < k) l = m + 1;
        else if (a[m] > k) r = m - 1;
        else return count;
    }
    return count;
}

int main() {
    while (true) {
        int n;
        cin >> n;
        if (!n) return 0;
        int a[n];
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        int k;
        cin >> k;
        cout << search(a, n, k) << endl;
    }
}