#include <cstdio>
using namespace std;

int main()
{
	int array[1000];
	int n;
	
	while (scanf("%d", &n), n){
		for (int i = 0; i < n; i++){
			scanf("%d", &array[i]);
		}
		
		int q;
		scanf("%d", &q);
		
		int l = 0;
		int r = n - 1;
		int cnt = 0;
		while (1){
			int m = (l + r) / 2;
			
			cnt++;
			
			if (q == array[m]){
				break;
			}
			
			else if (l == r){
				break;
			}
			
			else if (q < array[m]){
				r = m - 1;
			}
			
			else if (q > array[m]){
				l = m + 1;
			}
		}
		
		printf("%d\n", cnt);
	}
	
	return 0;
}