def solve array, target
  count = 0
  left = 0
  right = array.size - 1

  loop do
    center = (left + right) / 2
    count += 1
    break if left == right || array[center] == target
    if array[center] < target
      left = center + 1
    elsif array[center] > target
      right = center - 1
    end
  end

  count
end

while (n = $stdin.gets.to_i) != 0
  array = Array.new
  n.times do
    array << $stdin.gets.to_i
  end
  p solve(array, $stdin.gets.to_i)
end