#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define INF 1<<30

int main() {
  int n;
  while(cin >> n, n) {
    vector<int> v(n);
    REP(i,n)
      cin >> v[i];
    int a;
    cin >> a;

    sort(ALL(v));
    int lb = 0, ub = n - 1;
    int res = 0;
    while(ub-lb>=0) { // ツつアツつアツづ債適ツ督鳴づ可。
      int mid = (lb+ub)/2;
      //cout << mid << endl;
      ++res;
      if (v[mid] < a) lb = mid + 1; 
      else if (v[mid] > a) ub = mid - 1;
      else break;
    }
    // if (v[lb] != a)
    //   ++res;
    cout << res << endl;
  }
}