#include <bits/stdc++.h>

using namespace std;

int SortedData[100];

int main() {
	int n, k, cnt, left, right, mid;

	while (cin >> n, n) {
		for (int i = 0; i < n; i++) {
			cin >> SortedData[i];
		}
		cin >> k;

		left = 0;
		right = n - 1;
		cnt = 0;
		while (1) {
			++cnt;
			mid = (left + right) / 2;
			if (SortedData[mid] == k) {
				break;
			}
			if (SortedData[mid] < k) {
				left = mid + 1;
			}
			else if (SortedData[mid] > k) {
				right = mid - 1;
			}
			if (left > right) {
				break;
			}
		}
		cout << cnt << endl;
	}

	return 0;
}
