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

using namespace std;

int binarySerch( const vector<int>& data, int target )
{
	int low, high;
	int answer = 0;
	low = 0;
	high = data.size() - 1;

	while( low <= high ){
		int ix = ( low + high ) / 2;
		answer++;
		
		if( data[ix] > target ){
			high = ix - 1;
		}else if( data[ix] < target ){
			low = ix + 1;
		} else {
			return answer;
		}
	}

	return answer;
}

int main(int argc, char const* argv[])
{
	int n;
	vector<int> data;
	int target;

	while( cin >> n && n != 0 ){
		data.clear();
		for( int i = 0;i < n;i++ ){
			int input;
			cin >> input;
			data.push_back( input );
		}
		cin >> target;

		sort( data.begin(), data.end() );

		cout << binarySerch( data, target ) << endl;
	}
	return 0;

}