#include <iostream>
using namespace std;

int bin_search(int x[],int size,int key)
{
	int low = 0,high = size-1;
	int count=0;
	while(low <= high){
		count++;
		int mid = (low+high)/2;
		if(x[mid] == key)
			return count;
		else if(x[mid] > key)
			high = mid-1;
		else
			low = mid+1;
	}
	return count;
}
int main()
{
	int size;
	int key;
	int x[101];
	while(cin >> size){
		if(size == 0)
			break;
		for(int i=0;i<size;i++){
			cin >> x[i];
		}
		cin >> key;
		cout << bin_search(x,size,key) << endl;
	}
	return 0;
}

/*
#include <iostream>
using namespace std;

static int count = 0;

int binary_search(int data[], int n, int x)
{
	int low = 0;
	int high = n-1;
	while(low<=high){
		count++;
		int middle = (high+low)/2;
		if(x==data[middle])
			return middle;
		else if(x<data[middle])
			high = middle-1;
		else
			low = middle+1;
	}
	return -1;
}

int main()
{
	const int n = 100000;
	int data[n];
	for(int i=0;i<n;i++){data[i] = i;}

	for(int i=0;i<n;i++){
		binary_search(data, n, data[i]);
	}

	cout << static_cast<double>(count)/n << endl;
	return 0;
}
*/