#include <iostream>
#include <vector>

using namespace std;

void solve()
{
	int n;
	while(cin >> n, n)
	{
		vector<int> Vec(n);
		for(int i = 0; i < n; ++i)
		{
			cin >> Vec[i];
		}
		int target;
		cin >> target;
		int left = 0;
		int right = n - 1;
		int count = 0;
		while(right >= left)
		{
			count++;
			int m = (left + right) / 2; 
			if(target == Vec[m])
			{
				break;
			}
			target < Vec[m] ? right = m - 1 : left = m + 1;
		}
		cout << count << endl;
	}
}

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