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

vector<int> arr;
int n;

int main(void){
  while(cin >> n, n){
    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 = 0, ub = n - 1;
    while(lb <= ub){
      int mid = (lb + ub) / 2;
      cnt++;
      if(arr[mid] == search){
        break;
      }if(arr[mid] > search){
        ub = mid - 1;
      }else{
        lb = mid + 1;
      }
    }
    cout << cnt << endl;
  }
  return 0;
}