import Data.List
import Data.List.Split

solve ls | length ls <= 1 = 0
         | otherwise = length $ head $ groupBy (==) $ reverse $ sort $ f ls [-1] (head ls)
  where f [] ys _ = ys
        f (x:xs) ys bottom | x < bottom = f xs ys x
                           | otherwise = f xs ((x - bottom):ys) bottom

main = do
  l1 <- getLine
  l2 <- getLine
  let ls = map (read::String->Int) $ splitOn " " l2
  let answer = solve ls
  putStrLn $ show $ answer
