#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int n;
  while (cin >> n, n) {
    int a[110];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    int k;
    cin >> k;
    int l = 0, r = n - 1, ans = 0;
    while (l <= r) {
      ans++;
      int m = (l + r) / 2;
      if (k < a[m]) r = m - 1;
      else if (a[m] < k) l = m + 1;
      else break;
    }
    cout << ans << endl;
  }

  return 0;
}
