#include<iostream>
using namespace std;
int bin(int x,int a[],int n){
	int r=n-1,l=0,mid,k=0;
	while(r-l>=1){
		mid=(r+l)/2;
		if(a[mid]>x)
		r=mid-1;
		else l=mid+1;
		k++;
	}
	return k+1;
}
int main(){
	int n,x,a[1000];
	while(cin>>n,n){
		for(int i=0;i<n;i++)
		cin>>a[i];
		cin>>x;
		cout<<bin(x,a,n)<<endl;
	}
	return 0;
}