#include<stdio.h>
#include<string.h>
#include<math.h>

int main(){
	int tan[1100],i,j,n,t,c;
	
	while(scanf("%d",&n)){
		if(n==0)break;
		
		for(i=0;i<n;i++){
			scanf("%d",&tan[i]);
		}
		scanf("%d",&t);
		
		i=0;
		j=n-1;
		c=0;
		while(i<=j){
			++c;
			if(tan[(i+j)/2]<t){
				i=(i+j)/2+1;
			}else if(tan[(i+j)/2]==t){
				break;
			}else{
				j=(i+j)/2-1;
			}
		}
		printf("%d\n",c);
	}
	return 0;
}