#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int n;
	while(cin>>n&&n!=0){
		vector<int> nums;
		int t;
		for(int i = 0; i < n; i++){
			cin>>t;
			nums.push_back(t);
		}
		int s;
		cin>>s;
		int ub=n;
		int lb=-1;
		int cnt=0;
		while(ub-lb>1){
			int mid=ub+lb;
			mid/=2;
			cnt++;
			if(nums[mid]==s){
				break;
			}
			else if(nums[mid]>s){
				ub=mid-1;
			}
			else if(nums[mid]<s){
				lb=mid+1;
			}
		}
		cout<<cnt+1<<endl;
	}

	return 0;
}