#include<iostream>
using namespace std;

int main(){
  int l,r,m,n,a[100],g,c;
  for(;;){
    cin >> n;
    if(!n)break;
    for(int i=0;i<n;i++)cin >> a[i];
    cin >> g;


    l = 0;r = n-1;
    c = 1;
    while(l<r){
      m = (l+r)/2;
      if(a[m]==g)break;
      else if(a[m]>g)r = m-1;
      else l = m+1;
      c++;
    }

    cout << c << endl;
  }
}