#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    while(cin>>n,n){
        int num[n],ans;
        for(int i=0;i<n;i++)cin>>num[i];
        cin>>ans;
        int serch=n/2,kawa[2]={0,n};
        for(int i=1;;i++){
            if(num[serch]==ans||i==n-1){
                cout<<i<<endl;
                break;
            }
            else if(num[serch]>ans){
                    kawa[1]=serch;
                    serch=(serch+kawa[0])/2;
            }
            else {
                    kawa[0]=serch;
                    serch=(serch+kawa[1])/2;
            }
        }
    }
}