#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
	int n;
	while (cin >> n&&n != 0) {
		int a[100], k = 0, s = 0, e = n - 1, sum = 0;
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}
		cin >> k;
		while (s - e!=1) {
			int b = floor((s + e) / 2);
			if (a[b] < k) {
				s = b+1;
				sum++;
			}
			else if (a[b] > k) {
				e = b-1;
				sum++;
			}
			else {
				sum++;
				break;
			}
		}
		cout << sum << endl;
	}
}