#include <iostream>
#include <stdlib.h>

using namespace std;

int main(int argc, char **argv)
{
	int *a, n, t, l, h, c, p;
	
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		a = (int *)calloc(n, sizeof(int));
		for(int i = 0; i < n; i++){
			cin >> a[i];
		}
		cin >> t;
		l = c = 0;
		h = n-1;
		while(l <= h){
			p = (l + h)/2;
			c++;
			if(t == a[p]){
				break;
			} else if(t < a[p]){
				h = p - 1;
			} else {
				l = p + 1;
			}
		}
		cout << c << endl;
		
		free(a);
	}
	
	
	return 0;
}