#include <iostream>
#include <algorithm>

using namespace std;

int a[100000];
int n;

int binary_search(int N){

  int r = n;
  int l = 0;
  int cnt = 0;
  int x = l;

  while(1){

    x = (r + l)/2;

    if( a[x] == N ){
      //cout << "match" << endl;
      cnt++;
      break;
    }
    else if( a[x] < N ){
      // cout << "right" << endl;
      cnt++;
      l = x;
    }
    else if( N < a[x] ){
      //cout << "left" << endl;
      cnt++;
      r = x;
    }
  }
  return cnt;
}

int main(void){

  while( cin >> n , n ){
  for( int i = 0 ; i < n ; i++ ) 
    cin >> a[i];
  int N;
  cin >> N;
  sort( a , a + n );
  cout << binary_search(N) << endl;
  }
  return 0;
}