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

using namespace std;

struct Info{
	int id,sum;
};

int main(){

   int n,k,table[100],left,right,count,m;

   while(true){
	   scanf("%d",&n);
	   if(n == 0)break;

	   for(int i=0; i < n; i++)scanf("%d",&table[i]);

	   scanf("%d",&k);

	   count = 0;
	   left = 0,right = n;
	   m = (left+right)/2;
	   while(true){
		   count++;
		   if(table[m] == k)break;
		   else{
			   if(right-left==1){
				   if(right <= n && table[right] == k)count++;
				   break;
			   }
			   if(table[m] < k){
				   left = m;
				   m = (left+right)/2;
			   }else{
				   right = m;
				   m = (left+right)/2;
			   }
		   }
	   }

	   printf("%d\n",count);

   }

    return 0;
}