#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;


int N, M;
int solve(vector<int> &v){
  int l = -1, r = (int)(v.size()), res = 0;
  while(r - l > 1){
    ++res;
    int m = (r + l) / 2;
    if(v[m] >= M) r = m;
    else l = m;
  }
  return res;
}

int main() {
  while(cin >>N && N){
    vector<int> v(N);
    REP(i, N) cin >>v[i];
    cin >>M;
    cout <<solve(v) <<endl;
  }
  return 0;
}