ans' m n d t =
  let i = n `div` 2
      c = d!!i
  in
    if n == 0 || c == t 
    then m+1
    else if t < c
         then ans' (m+1) i (take i d) t
         else ans' (m+1) (n-i-1) (drop (i+1) d) t

ans :: [Int] -> [Int]
ans (0:_) = []
ans (n:xs) =
  let d = take n xs
      t = head $ drop n xs
      r = drop (n+1) xs
  in
    (ans' 0 n d t):(ans r)

main = do
  c <- getContents
  let i = map read $ lines c :: [Int]
      o = ans i
  mapM_ print o