#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;
const int INF = 1 << 30;

int main()
{
	int n;

	while(cin >> n, n)
	{
		vector<int> T;
		int res = 0, num, up = n-1, low = 0;
		for(int i = 0; i < n; i++)
		{
			int a; cin >> a;
			T.push_back(a);
		}
		cin >> num;

		while( low <= up )
		{
			int mid = (up + low) / 2;
			res++;
			if(T[mid] > num)
			{
				up = mid-1;
			}
			else if(T[mid] < num)
			{
				low = mid+1;
			}
			else
			{
				break;
			}
		}
		
		cout << res << endl;
	}
}