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

using namespace std;

int main(int argc, char **argv)
{
	int n, *a, t, m, c, p, q;
	
	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 >> m;
		p = c = 0;
		q = n;
		t = (n-1+p) / 2;
		while(t != p){
			if(a[t] < m){
				p = t;
				t = (q+p) / 2;
			} else {
				q = t;
				t = (q+p) / 2;
			}
			c++;
		}
		cout << c << endl;
		
		free(a);
	}
	
	return 0;
}