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

#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)

int n, l[100], t;

void solve() {
  rep(i,n) cin>>l[i];
  cin>>t;
  
  int lb = 0, ub = n-1, res = 1;
  while (ub != lb) {
    //if (lb > ub) break;
    int mid = (ub+lb)/2;
    //printf("lb=%d ub=%d mid=%d\n", lb, ub, mid);
    
    
    if (l[mid] < t) {
      if (mid != ub) lb = mid + 1;
      else lb = mid;
    }
    else  if (l[mid] > t) {
      if (mid != 0) ub = mid - 1;
      else ub = mid;
    } else {
      break;
    }
    res++;
  }

  cout<<res<<endl;
}

int main (int argc, char const* argv[]) {
  while (cin>>n, n) {
    solve();
  }
  return 0;
}