#include<iostream>
#include<cstdio>
#include<vector>
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;
		for (int i = 0; i < 100; i++) {
			if (MAX - MIN == 1) { cout << i + 2 << endl; break; }
			int k = (MIN + MAX) / 2;
			if (b[k] > d)MAX =k-1;
			else if (b[k] < d)MIN =k+1;
			else { cout << i + 1 << endl; break; }
		}
	}
}