#include <cstdio>
#include <cstring>
using namespace std;

const int MAX_N = 100;
int values[MAX_N];

int main(){
	int n;
	while(scanf("%d", &n), n != 0){
		// target: 探す値, ans: 探索が終わるまでの比較回数
		int target, ans = 0;
		// 二分探索の範囲
		int l = 0, r = n - 1;
		
		memset(values, 0, sizeof(values));
		for (int i = 0; i < n; i++) {
			scanf("%d", &values[i]);
		}
		scanf("%d", &target);
		
		while(l <= r) {
			ans++;
			int m = (l + r) / 2;
			if (values[m] == target) break;
			else if (values[m] < target) l = m + 1;
			else r = m - 1;
		}
		printf("%d\n", ans);
	}
	return 0;
}