import Data.Array.IO
import Control.Monad

main = do
  n <- readLn :: IO Int
  a <- getLine >>= return . (map read) . words :: IO [Int]
  arr <- newArray (0, 100000) 0 :: IO (IOArray Int Int)

  forM_ a $ \x -> do
    arrIncr arr x
    when (x>0) (arrIncr arr (x-1))
    when (x<100000) (arrIncr arr (x+1))


  print =<< return . maximum =<< getElems arr
    
  where
    arrIncr arr i = do
      r <- readArray arr i
      writeArray arr i (r+1)

