#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int main()
{
	int n;
	while(scanf("%d", &n), n){
		int a[100];
		rep(i, n)
			scanf("%d", &a[i]);
		
		int key;
		scanf("%d", &key);
		
		int cnt = 0;
		int left = 0, right = n;
		while(left < right){
			++cnt;
			int mid = (left + right-1) / 2;
			if(a[mid] == key)
				break;
			if(a[mid] < key)
				left = mid + 1;
			else
				right = mid;
		}
		printf("%d\n", cnt);
	}
	return 0;
}