#include<iostream>
using namespace std;
int a[200];
int n;

int search(int i){
  int count = 0;
  int lix = 0,rix = n - 1;
  while(lix <= rix){
    cout << lix << rix << endl;
    int med = (lix + rix)/2;

    count++;
    if(a[med] == i)return count;

    if(a[med] < i){
      lix = med + 1;
      continue;
    }

    if(a[med] > i){
      rix = med - 1;
      continue;
    }
  }
  return count;
}

int main(){

  while(true){
    cin >> n;
    if(n == 0)break;
    for(int i = 0;i < n;i++){
      cin >> a[i];
    }
      
    int i;
    cin >> i;
    cout << search(i) << endl; 
  }
}