#include <iostream>
using namespace std;

void bubble(int N, int data[]){
	int tmp{};
	int cnt{};
	int i{}, j{};
	
	for(i=0;i<N;++i){
		cnt = 0;
		for(j=N-1;j>i;--j){
			if(data[j]<data[j-1]){
				tmp       = data[j-1];
				data[j-1] = data[j];
				data[j]   = tmp;
				cnt++;
			}
		}
		if(cnt==0) break;
	}
}

int BS(int key, int array[], int head, int tail, int count){
	count++;
	if(head >= tail){
		return count;
	}else{
		if(array[head + (tail-head)/2] == key){
			return count;
		}else{
			if(array[head + (tail-head)/2] > key){
				return BS(key, array, head, (tail-head)/2-1+head, count);
			}else{
				return BS(key, array, (tail-head)/2+1+head, tail, count);
			}	
		}
	}
}

int main() {
	int N{};
	int data[100]{};
	int key{};
	
	while(cin >> N, N!=0){
		for(int i=0; i<N; ++i){
			cin >> data[i];
		}
		cin >> key;
		
		bubble(N, data);
		
		cout << BS(key, data, 0, N, 0) << endl;
		
		for(int i=0;i<N;++i){
			data[i] = 0;
		}
	}
}