//
//
#include <iostream>
#include <vector>

using namespace std;

int nibo(int, vector<int>);

int main(void) {
	int n;
	vector<int> ans;

	while(true) {	
		cin >> n;
		if (n == 0) {
			break;
		}
		vector<int> data(n + 1 , 0);
		for (int i = 0; i < n + 1; i++) {
			cin >> data[i]; 
		}
		cout << nibo(n, data) << endl;
	}
       
	return 0;

}

int nibo(int n, vector<int> data) {
	int times = 0;
	int right = n - 1;
	int left = 0;
	int mid;
	int target = data[n];

	while(true) {
	        times++;
		mid = (right + left) / 2;
		if((right - left) == 0){
			break;
		}
		if (data[mid] == target) {
			break;
		}
		if (data[mid] < target) {
			left = mid + 1;
		}
		if (data[mid] > target) {
			right = mid - 1;
		}
	}
		
		

	return times;

}