#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
  int n,key,num[1000]={0};
  while( cin >> n,n ){
    for(int i = 0 ; i < n ; i++ ){
      cin >> num[i];
    }
    cin >> key;
    sort(num,num+n);
    int r = n-1;
    int l = 0;
    int cnt = 0;
    while(l <= r){
      int c = (r + l)/2;
      cnt++; 
      if(num[c] == key){break;}
      else if(num[c] < key){l = c+1;}
      else {r = c-1;}
    }
    cout << cnt << endl;
  }
  return 0;
}