while true
    n = gets.to_i
    break if n == 0
    arr = []
    n.times{arr << gets.to_i}
    k = gets.to_i
    count = 0
    left, right = 0, n - 1
    while left <= right
        count += 1
        center = (left + right) / 2
        if arr[center] == k
            break
        elsif arr[center] < k
            left = center + 1
        else
            right = center - 1
        end
    end
    puts count
end
