#include <iostream>
#include <algorithm>
using namespace std;
int main(void) {
	while (1) {
		long long n, a[110], k, ans, r, l;
		ans = 0;
		cin >> n;
		if (n == 0) {
			break;
		}
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}
		cin >> k;
		r = n-1;
		l = 0;
		while (r - l >= 0) {
			ans++;
			long long m = (l + r) / 2;
			if (a[m] == k) {
				break;
			}
			else if (a[m] > k) {
				r = m - 1;
			}
			else if (a[m] < k) {
				l = m + 1;
			}
		}
		cout << ans << endl;
	}
	return 0;
}