object Main extends App {

  import scala.io.StdIn._

  solve
  def solve:Unit = {
    val n = readLine.trim.toInt
    if (n == 0) return
    val numbers = Array.tabulate(n){_ ⇒ readInt}
    println(count(numbers, readInt))
    solve
  }
  def count(array: Array[Int], target: Int): Int = {
    var left = 0
    var right = array.length - 1
    var count = 0
    while(left <= right){
      val mid = (left + right) / 2
      count += 1
      if (array(mid) < target){
        left = mid + 1
      }else if (array(mid) > target){
        right = mid - 1
      }else {
        left = mid + 1
        right = mid
      }
    }
    count
  }
  implicit class Extension[T](val value :T) extends AnyVal {
    @inline
    def let[A](@inline func: T ⇒ A): A = func(value)
    @inline
    def also(@inline func: T ⇒ Unit): T = {func(value); value}
  }
}
