#include <iostream>
#include <vector>

using namespace std;

int main(void){
	int n;
	while(cin >> n && n){
		vector<int> v(n);
		int l=0,r=n-1,m,k,ans=0;;
		for(int i=0;i<n;i++){
			cin >> v[i];
		}
		cin >> k;
		while(l<=r){
			ans++;
			m = (r+l)/2;
			if(v[m] == k) break;
			if(v[m] < k){
				l = m+1;
			}else{
				r = m-1;
			}
		}
		cout << ans << endl;
	}
}