#include<iostream>
using namespace std;
int main(){
  while(true){
    int a[1000];
    int q;
    int n;
    bool found=false;
    int cmp = 0;
    cin >> n;
    if( n == 0 ) break;
    for(int i = 0; i < n; ++i){
      cin >> a[i];      
    }
    cin >> q;
    int l = 0;
    int r = n;
    int prem=-1;
    while(r-l>1){
      int m = (l+r)/2;
      //      if(prem==m)break;
      if(a[m]>q){
	++cmp;
	r=m;
      }else if(a[m]==q){
	++cmp;
	found=true;
	break;
      }else{
	++cmp;
	l=m;
      }
      prem=m;
    }
    if(!found)++cmp;
    cout << cmp << endl;
  }
  return 0;
}