#include <iostream>
using namespace std;

int n, target;

int binserch(int* s, int* e) {
	if (s == e) return 0;
	int* c = s + (e - s - 1) / 2;
	if (*c < target) {
		return binserch(c + 1, e) + 1;
	}
	else if (target < *c) {
		return binserch(s, c) + 1;
	}
	else {
		return 1;
	}
}

int main() {
	while (cin >> n, n) {
		int a[n];
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}
		cin >> target;
		cout << binserch(a, a + n) << endl;
	}
	return 0;
}