#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

int main(){
  int n;
  while(cin>>n, n){
    vector<int> v(n);
    REP(i,n) cin>>v[i];
    
    int cnt = 0;
    int low = 0, high = n-1;
    int s; cin>>s;
    while(true){
      int mid = (low+high)/2;
      //cout << "mid=" << mid << endl;
      cnt++;
      if(v[mid] == s) break;
      if(low == high) break;
      if(v[mid] > s){
	high = mid-1;
      }else{
	low  = mid+1; 
      }
      if(low > high) break;
    }
    cout << cnt << endl;
  }
  return 0;
}