#include <stdio.h>
int n, x, a[100];
int main() {
	while(scanf("%d", &n), n) {
		for(int i = 0; i < n; i++) scanf("%d", &a[i]); scanf("%d", &x);
		int l = 0, r = n - 1, c = 0; bool flag = false;
		while(r - l > 0) {
			int m = (l + r) / 2; c++;
			if(a[m] == x) {
				printf("%d\n", c + 1); flag = true; break;
			}
			if(a[m] > x) r = m - 1;
			else l = m + 1;
		}
		if(!flag) printf("%d\n", c + 1);
	}
}