#include <iostream>
using namespace std;

int main()
{
	int N;
	while(cin >> N, N)
	{
		int b[100];
		for(int i=0; i<N; i++)
			cin >> b[i];
		
		int s, lo=0, hi=N-1, cnt=0;
		cin >> s;
		
		while(hi>=lo)
		{
			cnt++;
			int mi=(hi+lo)/2;
			if(b[mi]==s) break;
			
			s>b[mi]?lo=mi+1:hi=mi-1;
		}
		cout << cnt << endl;
	}
}