#include<iostream>
using namespace std;
int n,a[200],x;
int solve(){
	int l=0,r=n-1,mid,ans=0;
	while(l<=r){
		mid=(l+r)/2;
		if(a[mid]==x)
			return ans+1;
		else
		if(a[mid]<x)
		l=mid+1;
		else r=mid-1;
		ans++;

	}
	return ans;
}
int main(){
	while(cin>>n,n){
		for(int i=0;i<n;i++)
		cin>>a[i];
		cin>>x;
		cout<<solve()<<endl;
	}
	return 0;
}