#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int,int> P;
typedef std::pair<int,P> State;

const int INF = 1001001001;

// S N E W(南北東西)
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

int N, A[100], V;

int count(int first, int last){
    if(first > last){return 0;}

    int mid = (first + last) / 2;
    if(A[mid] == V){
        return 1;
    }else if(A[mid] > V){
        return 1 + count(first, mid-1);
    }else{
        return 1 + count(mid+1, last);
    }
}

int main(){
    while(std::cin >> N, N){
        REP(i, N){
            std::cin >> A[i];
        }

        std::cin >> V;
        std::cout << count(0, N-1) << std::endl;
    }
}