#include<iostream>

int search(int *n, int key, int p, int l, int count){
	int c = (p+l)/2;
	int cnt = count+1;
	if(n[c] == key || p==l)
		return cnt;
	else if(n[c] < key)
		return search(n, key, c+1, l, cnt);
	else
		return search(n, key, p, c-1, cnt);
}

int main(){
	int *data, n, key, count, p, l, c;
	while(true){
		std::cin >> n;
		if(n==0)
			return 0;
		data = new int[n];
		for(int i=0; i<n; i++)
			std::cin >> data[i];
		std::cin >> key;
		std::cout << search(data, key, 0, n-1, 0) << std::endl;
		delete[] data;
	}
}