module Main where

import Data.List

main :: IO()
main = do
  _ <- getLine
  inputs <- map read . words <$> getLine
  print $ solve inputs

solve :: [Integer] -> Integer
solve = maximum . posibilities . allLists

allLists :: [Integer] -> [[Integer]]
allLists inputs = map (zipWith (+) inputs) adds where
  adds :: [[Integer]]
  adds = sub (length inputs) where
    sub 0 = [[]]
    sub n = concatMap (\l -> [1 : l, 0 : l, -1 : l]) $ sub (n - 1)

posibilities :: [[Integer]] -> [Integer]
posibilities = map (fromIntegral . maximum . map length . group . sort)
