#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)

int main(){
    int n;
    int a[1000];
    while(cin>>n && n){
        int cnt=0;
        rep(i,n)cin>>a[i];
        int f;cin>>f;
        int l=0, r=n-1;
        // [l,r]
        while(1){
            // cout << l << " " << r << endl;
            int m=(l+r)/2;
            cnt++;
            if(a[m]==f){}
            if(a[m]<f){
                l=m+1;
            }else{
                r=m-1;
            }
            if(l==r) break;
        }
        cout << cnt+1 << endl;
    }
}