#include<iostream>
using namespace std;
int s[100],ans;
int ok(int c){
  if(s[c]==ans) return 1;
  else if(s[c]<ans) return 2;
  else if(s[c]>ans) return 3;
} 
int main(){
  int n,max,min,count;
  while(cin>>n){
    //cout << n << endl;
    if(n==0) break;
    count=0;
    for(int i=0;i<n;i++) cin >> s[i];
    cin >> ans;
    min = 0;
    max = 6;
    while(1){
      count++;
      if(ok((min+max)/2)==1||min==max){
	cout << count << endl;
	break;
      }
      else if(ok((min+max)/2)==2) min = (min+max)/2 + 1;
      else max = (min+max)/2 - 1;
    }
  }
  return 0;
}