#include <iostream>

int binSearch(int* a, int n, int k)
{
	int res = 0;
	int lb = 0;
	int ub = n-1;
	while (lb <= ub) {
		int mid = (lb + ub) / 2;
		res++;
		if (a[mid] == k) return res;
		else if (a[mid] < k) lb = mid + 1;
		else ub = mid - 1;
	}
	return res;
}

int main()
{
	int n;
	while (true) {
		std::cin >> n;
		if (n == 0) break;
		int* a = new int[n];
		for (int i=0; i<n; i++) std::cin >> a[i];
		int k; std::cin >> k;
		std::cout << binSearch(a, n, k) << std::endl;
	}
	return 0;
}

