#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()

int main(void){
  int n ;
  while(cin>>n,n){
    int cnt = 0;
    vector<int> vec(n);
    for(int i = 0 ; i < n ; i ++){
      cin>>vec[i];
    }
    int find;
    cin>>find;
    bool ans = false;
    int l = 0 , r = n-1;
    while(l<=r){
      int mid = (l + r)/2;
      if(vec[mid]<find){
        l = mid + 1; 
      }else if(vec[mid]>find){
        r = mid - 1;
      }else{
        ans = true;
        cnt++;
        break;
      }
      cnt++;
    }
    cout<<cnt<<endl;
  }
  
}