#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	int n;
	while(cin >> n && n)
	{
		vector<int> v;

		rep(i,n)
		{
			int temp;
			cin >> temp;
			v.push_back(temp);
		}

		int p;
		cin >> p;
		
		int l = 0;
		int r = n-1;
		int count = 0;

		while(true)
		{
			int mid = (l + r) / 2;

			if(l > r) break;

			count++;

			if(v[mid] == p) break;

			if(v[mid] < p)
			{
				l = mid + 1;
			}
			else
			{
				r = mid - 1;
			}
		}

		cout << count << endl;
	}
	return 0;
}