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

int main() {
  int n;
  while(cin >> n, n) {
    int target;
    vector<int> v(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    cin >> target;

    int cnt = 1;
    bool b = false;
    int left = 0, right = n-1;
    while(left <= right) {
      int t = (right+left)/2;
      if(v[t] == target) {
        b = true;
        break;
      } else if(v[t] < target) {
        left = t+1;
      } else {
        right = t-1;
      }
      cnt++;
    }
    if(!b) cnt--;
    cout << cnt << endl;
  }
}