#include <bits/stdc++.h>
#define INF 114514810
#define FOR(i, r, n) for(int i=(r); i<(n); i++) 
#define REP(i, n) FOR(i, (0), n)

using namespace std;

int n, d[103], x, ct = 0;

bool twei(int k){
	int lb = -1; int ub = n;
	while (ub - lb > 1){
		ct++;
		int mid = (lb + ub) / 2;
		if (d[mid] == k) return 1;
		else if (d[mid] > k) ub = mid;
		else lb = mid;
	}
	return 0;
}

int main(){
	while (true){
		cin >> n;
		if (!n) break;
		REP(i, n)
			cin >> d[i];
		cin >> x;
		twei(x);
		cout << ct << endl;
		x = ct = 0;
	}
}