#include "bits/stdc++.h"
using namespace std;


int main() {
	while (1) {
		int N; cin >> N;
		if (!N)break;
		vector<int>vs(N);
		for (int i = 0; i < N; ++i)cin >> vs[i];
		int K; cin >> K;
		int amin = 0;
		int amax = N-1;
		int ans = 0;
		while (amin <=amax) {
			ans++;
			const int amid = (amin + amax) / 2;
			if (vs[amid] < K) {
				amin = amid+1;
			}
			else if (vs[amid] == K) {
				break;
			}
			else {
				amax = amid-1;
			}
		}
		cout << ans << endl;
	}
	return 0;
}