#include <iostream>
using namespace std;

int main(){
    int n;
    while(cin >> n, n != 0){
        int data[n];
        int value;
        for(int i=0; i<n; i++){
            cin >> data[i];
        }
        cin >> value;
        int left = 0;
        int right = n-1;
        int mid = 0;
        int cnt = 0;
        while(left <= right){
            mid = (left+right) / 2;
            if(value > data[mid]){
                cnt++;
                left = mid+1;
            }else if(value < data[mid]){
                cnt++;
                right = mid-1;
            }else{
                cnt++;
                break;
            }
        }
        cout << cnt << endl;
    }
    return 0;
}