#include <iostream>
#include <algorithm>

using namespace std;

int s[100010],t[50010];
int n, q, ans = 0;

bool binary_search(int x) {
	int l = 0, r = n-1;
	ans = 0;
	while (r - l >= 0) {
		int m = (l + r) / 2;
		if (s[m] == x) {
			ans++;
			return true;
		}
		else if (s[m] > x) {
			r = m-1;
			ans++;
		}
		else if (s[m] < x) {
			l = m+1;
			ans++;
		}
	}
	
	return false;
}
int main() {
	while (cin >> n, n) {
		for (int i = 0; i < n; i++) {
			cin >> s[i];
		}
		cin >> t[0];
		binary_search(t[0]);
		for (int i = 0; i < n; i++) {
			s[i] = 0;
		}
			cout << ans << endl;
	}
	return 0;
}