#include<bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef pair<int,string> P;
#define INF (1<<20)

int main(){
  int n;
  int num[1111];
  while(cin >> n, n){
    for(int i=0;i<n;i++){
      cin >> num[i];
    }
    sort(num,num+n);
    int tar; cin >> tar;
    int cnt = 0;
    int left = 0;
    int right = n-1;
    while(left < right){
      int mid = (left+right)/2;
      if(num[mid] == tar) break;
      else if(num[mid] > tar) right = mid - 1;
      else left = mid + 1;
      cnt++;
    }
    cout << cnt+1 << endl;
  }
}