#include<iostream>
using namespace std;

int main()
{
  int n;
  for(;cin>>n,n;)
    {
      int data[n];
      for(int i=0;i<n;i++)
	{
	  cin>>data[i];
	}
      int s;
      cin>>s;
      int hi=0,lo=n-1;
      int cnt=0;
      while(true)
	{
	  int p = (hi+lo)/2;

	  //	  cout<<"HI:"<<hi<<" LO:"<<lo<<" "<<cnt<<endl;
	  //	  cout<<"data[p]:"<<data[p]<<" s:"<<s<<endl;
	  if(hi>lo)
	    break;
	  cnt++;
	  if(data[p]==s)
	      break;
	  else if(data[p]<s)
	    hi=p+1;
	  else
	    lo=p-1;
	}
      cout<<cnt<<endl;
    }
}