#include<iostream>
#include<vector>
using namespace std;
int bs(int l,int r, int ans);
vector<int> lot;
int n,x;
int main(){
  while(cin >>n,n){
    lot.clear();
    for(int i=0,a; i<n; i++){cin >>a;lot.push_back(a);}
    cin >>x;
    cout <<bs(0,n-1,0)<<endl;
  }
  return 0;
}
int bs(int l, int r, int ans){
  int mid = (l+r)/2;
  if(l>r) return ans;
  if(lot[mid] == x) return ans+1;
  if(lot[mid] > x) return bs(l,mid-1,ans+1);
  return bs(mid+1,r,ans+1);
}