#include <iostream>
#include <vector>
using namespace std;
 
int main(){
	int n,t,c;
	int mid,high,low,key;
	vector<int> d;
	while(cin >> n && n){
		d.clear();c=0;
 
		for(int i=0;i<n;i++){
			cin >> t;
			d.push_back(t);
		}
 
		cin >> key;
		low=0;high=n-1;	
		do{
			mid=(low+high)/2;
 
			if(d[mid] < key)
				low = mid+1;
			else if(d[mid] > key)
				high = mid-1;
			c++;
		}while(key != d[mid] && mid !=high && mid !=low);
 
		cout << c << endl;
	}
}