#include<iostream>
using namespace std;
int main(){
	int n,m,d[100],hi,lo,c,md;
	while(cin>>n,n){
		hi=n-1,lo=c=0;
		for(int i=0;i<n;i++)cin>>d[i];
		cin>>m;
		while(hi>=lo){
			c++;
			md=(hi+lo)/2;
			if(d[md]<m)lo=md+1;
			else if(d[md]>m)hi=md-1;
			else break;
		}
		cout<<c<<endl;
	}
	return 0;
}