#include <iostream>

using namespace std;
int a[1000];

int bin_search(int m, int n, int k,int count) {
  int l = (m + n) / 2;
  if ( n < m) {
    return count;
  }
  count ++;
  if ( a[l] < k ) {
    return bin_search(l + 1, n, k, count);
  } else if ( a[l] > k ){
    return bin_search(m,  l - 1, k, count);
  }
  return count;
}

int main() {
  while (1) {
    int n;
    int k;
    cin >> n;
    if (n == 0) {
      return 0;
    }
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    cin >> k;

    int r = bin_search(0, n - 1, k,0);
    cout << r << endl;
  }
}