#include<utility>
#include<iostream>
using namespace std;

int n,num[100],aid,sum;

void reading();
void binary();

int main(){
	while(1){
		sum=0;
		cin >> n;
		if(n==0)break;

		reading();
		sort();
		binary();


		cout << sum << endl;
	}
	return 0;
}

void reading(){
	for(int i=0;i<n;++i)cin >> num[i];
	cin >> aid;
}

void binary(){
	int a=0,b=n-1,c;
	while(1){
		++sum;
		c = (a+b)/2;
		if(num[c]==aid || a==b)break;
		if(num[c]>aid)b = c-1;
		else a = c+1;
	}
}