import Data.List main = do n <- readLn as <- map read . words <$> getLine print (jenga n as) jenga n as = n - masc as where masc = maximum . map asc . tails asc = pred . length . foldl (\(a:acc) x -> if a