import Control.Monad
import Control.Applicative
import Data.List
import Data.Array
strToInt s = (read :: String -> Int) s

main = do

    n <- readLn :: IO Int
    an <- map strToInt . words <$> getLine
    let bn = (map (1+) an) ++ an ++ (map (\x -> (x-1) ) an)
   
    let x = maximum [length (filter (==i) bn) | i <- [-1..100001]]
    print x