#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;
	while (cin >> n && n != 0) {
		int num[100] = { 0 };
		for (int i = 0; i < n; i++) {
			cin >> num[i];
		}
		int sea;
		cin >> sea;
		int ans = 0;
		int index = (n >> 1) - !(n & 1);
		int cnt = n;
		while (cnt > 0) {
			ans++;
			cnt = cnt >> 1;
			if (num[index] == sea) {
				break;
			}
			if (num[index] > sea) {
				index = index - ((cnt >> 1) + (cnt & 1));
			}
			else {
				index = index + ((cnt >> 1) + (cnt & 1));
			}
		}
		cout << ans << endl;
	}
	return 0;
}