#include <iostream>
#include <vector>
//#include <fstream>

using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.search3", "r", stdin );
	int n;

	while (1){
		cin >> n;

		if (!n ){
			break;
		} // end if

		vector <int> a (n, 0 );
		for (int i = 0; i < n; ++i){
			cin >> a[i];
		} // end for

		int key;
		cin >> key;
		int first = 0, last = n - 1, mid;
		int res = 0;

		do{
			mid = (first + last)/2;		
			++res;
			if (a[mid] < key ){
				first = mid + 1;
			}else if (a[mid] > key ){
				last = mid - 1;
			}else{
				break;
			} // end if
		}while (first <= last ); // end while

		cout << res << endl;	
		
	} // end loop
		
	return 0;
}