#include <iostream>
using namespace std;
#define MAX 101

int cnt;

int binary_search(int array[MAX],int key,int n){
    int left = 0 , right = n-1 , mid;
    
    while(left <= right){
        mid = (left+right)/2;
        if(array[mid]==key){
            cnt++;
            break;
        }
        else if(key < array[mid]){
            right = mid-1;
            cnt++;
        }
        else{
            left = mid+1;
            cnt++;
        }
    }

    return cnt;
}

int main(){
    int n,array[MAX],key;
    
    while(cin >> n,n){
        for(int i = 0 ; i < n ; i++) cin >> array[i];
        cin >> key;
        cnt = 0;
        cout << binary_search(array,key,n) << endl;
    }
    
    return 0;
}