#include<iostream>
#include<algorithm>
/*
int compare_int(const void* a, const void* b){
	return ( *(int*)a - *(int*)b );
}
*/
int main(){
	int *data, n, key, count, p, l;
	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::qsort(data, n, sizeof(int), compare_int);
		std::sort(data,data+n);
		std::cin >> key;
		p=0, l=n-1, count = 0;
		while(true){
			count++;
			if(data[(p+l)/2] == key && p==l)
				break;
			if(p==l)
				break;
			if(data[(p+l)/2] > key)
				p = (p+l)/2+1;
			else
				l = (p+l)/2-1;
		}
		std::cout << count << std::endl;
	}
}