// 2011/08/24 Tazoe

#include <iostream>
using namespace std;

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

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

		int key;
		cin >> key;

		int cnt = 0;
		int left  = 0;
		int right = n-1;
		while(left<=right){
			int middle = (left+right)/2;
			cnt++;
			if(key==data[middle])
				break;
			else if(key<data[middle])
				right = middle-1;
			else
				left  = middle+1;
		}

		cout << cnt << endl;
	}

	return 0;
}