#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <cmath>
#include <queue>

using namespace std;

int a[100000];
int lef;
int rig;

int ans;

bool binary_search_2(int num){
	if(lef == rig){
		ans++;
		return false;
	}
	int middle = (lef + rig) / 2;
	ans++;
	if(a[middle] > num){
		rig = middle - 1;
		binary_search_2(num);
	}else if(a[middle] < num){
		lef = middle + 1;
		binary_search_2(num);
	}else if(a[middle] == num){
		return true;
	}
}

bool binary_search(int num, int n){
	lef = 0;
	rig = n - 1;
	binary_search_2(num);
}

int main(){
	
	int n, k;
	
	while(true){
		
		cin >> n;
		
		if(n == 0){
			break;
		}
		
		for(int i = 0; i < n; i++){
			cin >> a[i];
		}
		
		cin >> k;
		
		ans = 0;
		
		binary_search(k, n);
		
		cout << ans << endl;
		
	}
	
	return 0;
}