#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
while(cin>>n,n){
  int a[n];
  for (int i=0;i<n;++i){
    cin>>a[i];
  }
  
  int goal;
  cin>>goal;
  int left,right;
  
  left=0;
  right=n;
  if(a[n/2]==goal){
    cout<<1<<endl;
    continue;
  }
  int sum=1;
  while(left<right){
    if( a[(left+right)/2]==goal ){
break;
}
    if(a[(left+right)/2]>goal){right=(left+right)/2-1;}
    if(a[(left+right)/2]<goal){left=(left+right)/2+1;}
    sum++;
  }
  if(left==right){
    cout<<sum<<endl;
   }
  
  
 }
 return 0;
}