// 2011/02/05 Tazoe

#include <iostream>
using namespace std;

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

		int dat[100];
		for(int i=0; i<n; i++)
			cin >> dat[i];

		int key;
		cin >> key;

		int cnt = 0;
		for(int lef=0, rig=n-1; lef<=rig;){
			int mid = (lef+rig)/2;
			cnt++;
			if(key==dat[mid])
				break;
			else if(key<dat[mid])
				rig = mid-1;
			else
				lef = mid+1;
		}

		cout << cnt << endl;
	}

	return 0;
}