#include <iostream>
using namespace std;

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        int* array = new int [n];
        for (int i = 0; i < n; i++) {
            cin >> array[i];
        }
        int key;
        cin >> key;
        int count = 0, min = 0, max = n - 1, value = -1;
        while (min <= max) {
            value = array[(max + min) / 2];
            count++;
            if (key < value) {
                max = (max + min) / 2 - 1;
            } else if (key > value) {
                min = (max + min) / 2 + 1;
            } else {
                break;
            }
        }
        cout << count << endl;
        delete[] array;
    }
}