#include <iostream>
#include <vector>

using namespace std;

int main(){
    while(true) {
        int n = 0;
        cin >> n;
        if(n == 0) break;
        vector<int> v(n);
        int x;
        for(int i = 0; i < n; ++i){
            cin >> v[i];
        }
        cin >> x;
        int left = 0;
        int right = n - 1;
        int cnt = 0;
        while(true){
            int pivot = (right + left) / 2;
            int elem = v[pivot];
            if(left > right) break;
            cnt++;
            if( elem < x ){
                left = pivot + 1;
            } else if ( elem > x ) {
                right = pivot - 1;
            } else {
                break;
            }
        }
        cout << cnt << endl;
    }
    return 0;
}