#include<iostream>
#include<vector>

using namespace std;

int SearchCount(vector<int>, int);

int main(){
  int i, n, m, Search, Count;
  vector<int> data;

  while(1){
    cin >> n;
    if(n == 0) break;

    for(i=0; i<n; ++i){
      cin >> m;
      data.push_back(m);
    }
    cin >> Search;

    Count = SearchCount(data, Search);
    cout << Count << endl;
    data.clear();
  }

  return 0;
}

int SearchCount(vector<int> data, int Search){
  int middle, left = 0, right = data.size()-1, count=0;

  while(right >= left){
    middle = (left + right)/2;
    count++;
    if(Search == data[middle]){
      break;
    }else if(Search < data[middle]){
      right = middle-1;
    }else{
      left = middle+1;
    }      
  }
  return count;

}