#include<iostream>

using namespace std;


int main(){
	int num[101],r[2];
	int kazu, target, t;
	int i;

	while (1){
		t = 0;
		cin >> kazu;

		if (kazu == 0){
			break;
		}

		for (i = 0; i < kazu; i++){
			cin >> num[i];
		}

		cin >> target;


		r[0] = 0;
		r[1] = (kazu - 1);
		t = 0;
		
		while (1){
			t++;
			if (num[(r[0] + r[1]) / 2] == target){
				break;
			}

			if (r[0] == r[1]){
				break;
			}

			if (num[(r[0] + r[1]) / 2] < target){
				r[0] = (r[0] + r[1]) / 2 + 1;
			}
			else{
				r[1] = (r[0] + r[1]) / 2 - 1;
			}
								
		}


		cout << t << endl;
	}

}