#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		int d[100];
		for (int i = 0; i <= n; ++i)
			scanf("%d", d + i);

		int l = 0;
		int u = n-1;
		int ans = 0;
		while (l <= u)
		{
			++ans;
			int m = (l + u) / 2;
			if (d[m] == d[n])
				break;
			else if (d[m] > d[n])
				u = m - 1;
			else
				l = m + 1;
		}
		printf("%d\n", ans);
	}

	return 0;
}