#include <cstdio>

int n,k;
int a[100001];

int main(void){
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(int i=0;i<n;i++){
			scanf("%d",&a[i]);
		}
		scanf("%d",&k);
		int l=0,r=n-1,cnt=0;
		while(1){
			cnt++;
			int m=(l+r)/2;
			if(m<0)break;
			//printf("%d %d %d %d %d %d\n",l,m,r,a[l],a[m],a[r]);
			if(a[m]==k || r-l<=0)break;
			if(a[m]<k)l=m+1;
			if(a[m]>k)r=m-1;
			if(r-l<0)break;
		}
		printf("%d\n",cnt);
	}
	return 0;
}