#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    int p,l=0,r=n-1,t=0;
    cin>>p;
    while(l<=r){
      t++;
      int mid=(l+r)/2;
      if(a[mid]==p)break;
      if(a[mid]>p)r=mid-1;
      else l=mid+1;
    }
    cout<<t<<endl;
  }
}