#include<iostream>
using namespace std;
int main(){
    int n,a[100],X;
    while(1){
    cin >> n;
    if(n==0)break;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    cin >> X;
    int high=n-1,low=0,cnt;
    for(int i=0;i<n;i++){
        int center=(low+high)/2;
        if(a[center]==X){
            cnt=i+1;
            break;
        }
        else if(a[center]<X) low=center+1;
        else high=center-1;
    }
    cout << cnt << endl;
    }
}