#include<iostream>
#include<algorithm>

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::sort(data, data+n);
		std::cin >> key;
		p=0, l=n-1,count = 1;
		while(true){
			if(p>l)
				break;
			c = (p+l)/2;
			if(data[c] == key && p==l)
				break;
			if(data[c] > key)
				p = c+1;
			else
				l = c-1;
			count++;
		}
		std::cout << count << std::endl;
		delete[] data;
	}
}