
#include<iostream>
#include<vector>
using namespace std;

int main()
{
  int n, i;
  int m;
  int left, right, count;
  vector<int> v;
  while (cin>>n, n) {
    v.clear();
    v.resize(n);
    for (i = 0; i < n; i++) cin>>v[i];

    cin>>m;
    count = 0;
    left = 0;
    right = n-1;
    while (left <= right) {
      count++;
      if (v[(right-left)/2+left] > m) right = (right-left)/2+left-1;
      else if (v[(right-left)/2+left] < m) left = (right-left)/2+left+1;
      else {
	left = right = (right-left)/2+left;
	break;
      }
    }
    cout<<count<<endl;
  }

  return 0;
}