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

#define DEBUG(x) cerr << #x << " = " << x << endl

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

        int lb = 0, ub = n - 1, mid;
        int ans = 0;
        while(++ans, mid = (ub + lb) / 2, data[mid] != target && ub > lb) {
            if(target < data[mid]) {
                ub = mid - 1;
            }
            else {
                lb = mid + 1;
            }

            if(ans > 5) break;
        }
        cout << ans << endl;
    }
}