#include <iostream>
#include <vector>
using namespace std;

int main() {
	int n;
	while(cin >> n, n) {
		vector<int> v;
		int f;
		for(int i = 0; i < n; i++) {
			int tmp;
			cin >> tmp; v.push_back(tmp);
		}
		cin >> f;

		int l, r;
		l = 0; r = v.size() - 1;
		int ans = 0;
		while(l <= r) {
			int m;
			m = (l + r) / 2;
			ans++;
			if(v[m] == f)
				break;
			else if(v[m] < f)
				l = m + 1;
			else
				r = m - 1;
		}

		cout << ans << endl;
	}
}