#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstring>
#include <cmath>
#include <cstdio>
 
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair
#define X first
#define Y second
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()

using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> P;

const int INF = 1<<29;

int num[101];
int main(void){
	int n;
	while(cin >> n, n){
		rep(i, n) cin >> num[i];
		int x;
		cin >> x;

		int lb = 0, ub = n-1;
		int ans = 0;
		while(1){
			int mid = (ub+lb)/2;
			ans++;
			if(ub <= lb) break;
			if(num[mid] == x) break;
			if(num[mid] < x) lb = mid+1;
			else ub = mid-1;
		}

		cout << ans << endl;
	}

    return 0;
}