import Data.List
import Data.Function

gaps :: [Int] -> [Int]
gaps [] = []
gaps (x:xs) = hs ++ gaps xs
  where hs = map (subtract x) xs

maximumsCount :: [Int] -> Int
maximumsCount xs = fst res
  where res = foldl' next (0, 0) xs
        next (acc, x) y
          | y > x = (1, y)
          | y == x = (acc + 1, x)
          | otherwise = (acc, x)

main :: IO ()
main = do
  getLine
  line <- getLine
  let xs = read <$> words line :: [Int]
  print $ maximumsCount $ gaps xs
