#include<cstdio>

using namespace std;

int a[101];

int binarysearch(int tar,int l,int r)
{
	if(l>r)	return 0;

	int m=(l+r)/2;
	if     (a[m]==tar)	return 1;
	else if(a[m]<tar)	return 1+binarysearch(tar,m+1,r);
	else				return 1+binarysearch(tar,l,m-1);
}

int main()
{
	for(int n;scanf("%d",&n),n;){
		for(int i=0;i<n;i++)	scanf("%d",a+i);
		int tar;	scanf("%d",&tar);
		printf("%d\n",binarysearch(tar,0,n-1));
	}
	return 0;
}