def binary_search(arr, target)
  left = 0
  right = arr.size - 1
  count = 0
  while left < right
    mid = (left + right)/2
    count += 1
    if arr[mid] == target
      break
    elsif arr[mid] < target
      left = mid + 1
    else
      right = mid
    end
  end
  return count
end

loop do
  n = gets.to_i
  break if n == 0
  arr = n.times.map{ gets.to_i }
  ta = gets.to_i
  puts binary_search(arr, ta)
end