#include <bits/stdc++.h>

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 100
typedef long long ll;

int n = -1;
int a[101];
int k;

void serch(int k)
{
	
	int ans = 1;

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

	}


	return 0;
}