#include <iostream>
#include <vector>
using namespace std;

vector<int> arr;
int n;

int main(void){
  while(true){
    cin >> n;
    if(!n) break;
    int num;
    arr.clear();
    for(int i = 0; i < n; i++){
      cin >> num;
      arr.push_back(num);
    }
    int search, cnt = 0;
    cin >> search;
    int lb = -1, ub = n;
    while(ub - lb > 1){
      int mid = (lb + ub) / 2;
      cnt++;
      if(arr[mid] >= search){
        ub = mid;
      }else{
        lb = mid;
      }
    }
    cout << cnt << endl;
  }
  return 0;
}