#include<iostream>
using namespace std;
int a[114514];
int n, key;
int binary_search(int sum, int l, int r) {
	if (l > r)return sum;
	int m = (l + r) / 2;
	sum++;
	if (a[m] == key)return sum;
	else if (l == r&&a[m] != key)return sum;
	else if (a[m] > key)return binary_search(sum, 0, m - 1);
	else return binary_search(sum, m + 1, r);
}
int main() {
	while (cin >> n) {
		if (!n)return 0;
		for (int i = 0; i < n; i++)cin >> a[i];
		cin >> key;
		cout << binary_search(0, 0, n - 1) << endl;
	}
}