
ans :: [Int] -> [Int]
ans (0:_) = []
ans (n:xs) =
  let d = take n xs
      t = head $ drop n xs
      r = drop (n+1) xs
      ans' m a = a `seq`
        let (b,e) = a
            i = (b+e) `div` 2
            c = d!!i
        in
          if c == t 
          then m
          else if b == e
               then m
               else 
                 if t < c
                 then ans' (m+1) (b,i-1)
                 else ans' (m+1) (i+1,e)
  in
    (ans' 1 (0,n-1)):(ans r)

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