#include <iostream>
#include <vector>
#include <string>

#define ARRAY_SIZE 100

int binary_search(int a[], int n, int x) {
  int l = 0, r = n + 1, search_count = 0;
  int res = -1;
  while ( l <= r ) {
    int mid = (l + r) / 2;
    if (x < a[mid]) {
      res = mid;
      r   = mid - 1;
    } else {
      l = mid + 1;
    }
    search_count++;
  }
  return search_count;
}

int main() {

  int num, search_num;
  int array[ARRAY_SIZE];

  std::cin >> num;
  while ( num != 0 ) {
    for (int i = 0; i < num; i++) {
      std::cin >> array[i];
    }
    std::cin >> search_num;

    std::cout << binary_search(array, num, search_num) << std::endl;

    std::cin >> num;
  }

}