#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  while(true){
    int n;
    cin >> n;
    if(n == 0){
      break;
    }
    vector<int> a(n);
    for(int i = 0; i < n; ++i){
      cin >> a[i];
    }
    int t;
    cin >> t;
    int ans = 0;
    int left = 0, right = n - 1;
    while(left <= right){
      ++ans;
      int mid = (left + right) / 2;
      if(a[mid] == t){
	break;
      }
      if(a[mid] > t){
	right = mid - 1;
      }
      else{
	left = mid + 1;
      }       
    }
    cout << ans << endl;
  }
  return 0;
}