#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>

using namespace std;

#define all(c) c.begin(),c.end()
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

typedef long long ll;
typedef vector<int> vi;

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& val){
    os << "[ ";
    for(typename vector<T>::const_iterator it=val.begin();
        it != val.end();++it){
        os << *it << " ";
    }
    os << "]";
    return os;
}

int solve(const vi& d,int f){
    int N = d.size();
    int head = 0;
    int tail = N-1;
    int ret = 0;
    // debug(d);
    // debug(f);
    while(true){
        int mid = (head + tail) / 2;
        ret++;
        // debug(mid);
        // debug(d[mid]);
        // debug(ret);
        if(d[mid] == f){
            // debug(d[mid]);
            return ret;
        }else if(d[mid] < f){
            head = mid + 1;
        }else if(d[mid] > f){
            tail = mid - 1;
        }
        if(head > tail){
            return ret;
        }
    }
    return -1;
}

int main(){
    while(true){
        int n;
        cin >> n;
        if(n == 0) break;
        vi d(n);
        rep(i,n) cin >> d[i];
        int f;
        cin >> f;
        cout << solve(d,f) << endl;
    }
    return 0;
}