#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> P;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int data[101];
int bs(int head,int tail,int m, int n){
  int mid = (head+tail)/2;
  if(head>tail) return(n-1);
  if(data[mid]>m){
    return bs(head,mid-1,m,n+1);
  }else if(data[mid]<m){
    return bs(mid+1,tail,m,n+1);
  }else{
    return (n);
  }
}
int main(void){
  int n;
  while(cin>>n){
    if(n==0) break;
    int m;
    REP(i,n)cin>>data[i];
    cin>>m;
    if(n==1) cout<<1<<endl;
    else cout<<bs(0,n-1,m,1)<<endl;
  }
  return 0;
}