#include <iostream>
#include <algorithm>
using namespace std;
  
int T[100010];
int find(int m,int x){
    int r=0,l=m-1,ans=0;
    while(1){
        ans++;  
        if(r>=l)break;
        if(T[(r+l)/2]==x)return ans;
        if(T[(r+l)/2]>x)l=(r+l)/2-1;
        else if(T[(r+l)/2]<x)r=(r+l)/2+1;
if(r>l) break;
    }
    return ans;
}
int main(){
    int n,k,num,ans;
    while(1){
        cin>>n;
        if(n==0)break;
        for(int i=0;i<n;i++){
            cin>>T[i];
        }
        cin>>k;
        ans=find(n,k);
        cout<<ans<<endl;
    }
    return 0;
}