#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

int main() {
	int a;
	while (cin>>a,a)
	{
		int b[100];
		for (int c = 0; c < a; c++)scanf("%d", &b[c]);
		int d; cin >> d;
		int MIN = 0, MAX = a - 1;
		int i = 0;
		while(MIN-MAX!=1) {
			int k = floor(double(MIN + MAX) / (double)2);
			if (b[k] > d) { MAX = k - 1; i++; }
			else if (b[k] < d) { MIN = k + 1; i++; }
			else { i++; break; }
		}
		cout << i << endl;
	}
}