#include<iostream>
#include<vector>

std::vector<int> v;

int main()
{
	int n;
	while( std::cin >> n, n )
	{
		v.clear();

		for( int i = 0; i != n; ++i )
		{
			int a;
			std::cin >> a;
			v.push_back( a );
		}

		int b;
		std::cin >> b;

		int ans = 0;
		int l = 0, r = v.size() - 1;
		while( l <= r )
		{
			int mid = ( l + r ) / 2;

			++ans;

			if( r <= l )
				break;

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

		std::cout << ans << std::endl;
	}

	return 0;
}