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

int main(){
	int n;
	while(cin>>n,n){
		int a[114];
		for(int i=0;i<n;i++)cin>>a[i];
		int k;
		cin>>k;
		
		int lb=-1;
		int ub=n;
		int ans=0;
		while(ub-lb>1){
			int mid=(ub+lb)/2;
			if(a[mid]==k){
				ans++;
				break;
				}
			else if(a[mid]>k){
				ans++;
				ub=mid;
				}	
			else{
				ans++;
				lb=mid;
				}	
			}
		cout<<ans<<endl;	
		}
		return 0;
	}