#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int n, comparison;
int num[101];

void binarysearch(int v){
  int l = 0;
  int r = n-1;
  int x;
 
  while(l <= r){
    x = (l+r)/2;
    comparison++;
    if(num[x] < v) l = x+1;
    else if(num[x] > v) r = x-1;
    else break;
  }
}

int main(){
  int search_value;
  
  while(cin >> n, n){
    comparison = 0;
    for(int i = 0 ; i < n ; i++){
      cin >> num[i];
    }
    cin >> search_value;
    
    binarysearch(search_value);
    
    cout << comparison << endl;
  }
  return 0;
}



    
    