#include <iostream>
using namespace std;

int main(){
	int n;
	while( cin >> n, n ){
		int a[101], key;
		for(int i=0 ; i < n ; i++ ){
			cin >> a[i];
		}
		cin >> key;
		
		int low = 0, high = n, mid = -1, cnt = 0;
		while( true ){
			cnt++;
			mid = (low + high) / 2;
			
			if( a[mid] == key ){
				break;
			}else if( a[mid] < key ){
				if( low == mid ) break;
				low = mid;
			}else{
				if( high == mid ) break;
				high = mid;
			}
		}
		cout << cnt << endl;
	}
}