#define _CRT_SECURE_NO_WARNINGS

#include<fstream>
#include<iostream>
#include<string>
#include<iomanip>
#include<list>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

int main(){
	int n = 0;
	int num[100];
	while (cin >> n && n != 0) {
		int now = n >> 1;
		int n_cnt = n;
		int sea;
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			cin >> num[i];
		}
		cin >> sea;
		while (n_cnt > 0) {
			cnt++;
			n_cnt = n_cnt >> 1;
			if (num[now] == sea) {
				break;
			}
			else if (num[now] > sea) {
				now -= (n_cnt - (n_cnt >> 1));
			}
			else {
				now += (n_cnt - (n_cnt >> 1));
			}
		}
		cout << cnt << endl;
	}
	return 0;
}