#include<iostream>

int main(){
	int n, a[100], search_i;
	while(std::cin >> n, n){
		for(int i=0;i<n;i++){
			std::cin >> a[i];
		}
		std::cin >> search_i;

		int ub = n, lb = -1, t = 0;
		while(ub - lb > 1){
			int mid = (ub + lb) / 2;
			if(a[mid] >= search_i){
				ub = mid;
			}else{
				lb = mid;
			}
			t++;
		}

		std::cout << t << std::endl;
	}
}