#include<bits/stdc++.h>
using namespace std;

int main()
{
  int n;
  while( cin >> n, n ) {
    int target;
    int cnt = 0;
    int l = 0, r = n-1, m;
    int data[100001];
   
    for(int i=0; i<n; i++) cin >> data[i];
    cin >> target;
    
   

    while( l <= r ) {
      m = (l+r) / 2;
      cnt++;
      if( data[m] == target ) break;
      if( target > data[m] ) l = m+1;
      else r = m-1;
    }

    cout << cnt << endl;
  }

}