#include<iostream>
using namespace std;

int n,k;
int* a;

int binary_search(){
	int l=0,r=n-1;
	int ans = 0;
	while(l<=r){
		int m = (l+r)/2;
		if(ans++,k == a[m])
			break;
		else if(k>a[m])
			l = m+1;
		else
			r = m-1;
	}
	return ans;
}

int main(){
	while(true){
		cin >> n;
		if(!n)
			return 0;
		a = new int[n];
		for(int i=0; i<n; i++)
			cin >> a[i];
		cin >> k;
		cout << binary_search() << endl;
		delete[] a;
	}
}