#include<iostream>
using namespace std;

int box[10000];
int num = 0;
int findn;
bool check(int begin, int end){
	if (begin > end)return true;
	num++;
	if (box[(begin + end) / 2]>findn)check(begin, (begin + end) / 2-1);
	else if (box[(begin + end) / 2]<findn)check((begin + end) / 2+1, end);
	else if (box[(begin + end) / 2] == findn)return true;
	return false;
}

int main(){
	int n;
	while(1){
		num=0;
		cin >> n;
		if(n==0)break;
		for (int i = 0; i<n; i++){
			cin >> box[i];
		}
		cin >> findn;
		bool TF=check(0, n - 1);
		cout << num << endl;
	}
	return 0;
}