#include <iostream>
using namespace std;

int main(){
    int cnt;
    int n,fig;
    int min,max,mid;
    while(1){
        cnt = 0;
        cin >> n;
        min = 0;
        max = n-1;
        int num[n];
        if(n == 0) break;
        for(int i=0;i<n;i++) cin >> num[i];
        cin >> fig;
        while(min <= max){
            mid = (min + max)/2;
            if(num[mid] == fig){
                cnt++;
                break;
            }
            else if(num[mid] < fig){
                min = mid + 1;
                cnt++;
            }
            else if(num[mid] > fig){
                max = mid - 1;
                cnt++;
            }
        }
        cout << cnt << endl;
    }
}