#include <iostream>
#include <vector>

using namespace std;

int search(int& target, vector<int>& data, int l, int r, int count)
{
	if(l > r)
	{
		return(count);
	}
	++count;
	int pos = (l + r) / 2;	
	if(data[pos] == target)
	{
		return(count);
	}
	else if(data[pos] < target)
	{
		return(search(target, data, pos + 1, r, count));
	}
	else
	{
		return(search(target, data, l, pos - 1, count));
	}
}

void solve()
{
	int n;
	while(cin >> n, n)
	{
		vector<int> data(n);
		for(int i = 0; i < n; ++i)
		{
			cin >> data[i];
		}
		int target;
		cin >> target;
		cout << search(target, data, 0, data.size() - 1, 0) << endl;
	}
}

int main()
{
	solve();
	return(0);
}