#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
typedef vector<int> VI;

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()

#define EACH(i, c) \
  for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define SORT(c) sort((c).begin(), (c).end())

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
const double PI = acos(-1.0);
#define CLR(a) memset((a), 0, sizeof(a))



//map<string,string> d;

void takakuwa(int n){
	int hidari=0;
	int migi = n-1;
	vector<int> kuwa;
	REP(i,n){
		int j;
		cin >> j;
		kuwa.push_back(j);
	}
	int mokuteki;
	cin >> mokuteki;
	int ans=0;
	while(migi >= hidari){
		int chushin = (hidari+migi)/2;
		ans++;
		if (kuwa.at(chushin) == mokuteki) break;
		if (kuwa.at(chushin) < mokuteki) hidari= chushin+1;
		if (kuwa.at(chushin) > mokuteki) migi = chushin-1;
		
	}
	cout << ans << "\n";

}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  while (cin >> n  &&n ) {
    takakuwa(n);
  }
  return 0;
}