#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 1145141919
#define MOD 1000000007
#define ALL(a) begin((a)),end((a))
#define MS(m,v) memset(m,v,sizeof(m))
#define D10  fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef long long ll;
struct edge
{
	int from, to, cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator >(const edge& e) const { return cost > e.cost; }
};
typedef vector<edge> edges;
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///

vi v;
int cnt;

void solve(int lb, int ub, int k)
{
	while (ub-lb>1)
	{
		cnt++;
		int mid = (lb + ub) / 2;
		if (v[mid] == k) return;
		if (v[mid] > k) ub = mid;
		else lb = mid;
	}
}

int main()
{
	int n;
	while (cin >> n, n)
	{
		v.clear();
		cnt = 0;
		REP(i, n)
		{
			int a;
			cin >> a;
			v.push_back(a);
		}
		int k; cin >> k;
		solve(-1, n, k);
		cout << cnt << endl;
	}
	return 0;
}