#include <bits/stdc++.h>
using namespace std;

int main(){
	int n, s, cnt, bottom, mid, top;
	vector< int > seq;
	
	while(cin >> n, n){
		seq.clear();
		seq.resize(n);
		for(int i = 0; i < n; ++i){
			cin >> seq[i];
		}
		cin >> s;
		
		cnt = 0;
		
		bottom = 0;
		top = n - 1;
		mid = (top + bottom) / 2;
		
		while(1){
			++cnt;
			
			if(top - bottom <= 0) break;
			
			if(seq[mid] == s){
				break;
			}else if(seq[mid] > s){
				top = mid - 1;
			}else if(seq[mid] < s){
				bottom = mid + 1;
			}
			
			mid = (top + bottom) / 2;
		}
		
		cout << cnt << endl;
	}
	
	return 0;
}