import Data.List
import Data.Ord
main = do
  t <- readLn :: IO Int
  s <- fmap (map read . words) getLine :: IO [Int]
  print $ length . last . sortBy (comparing length) . group . sort $ s ++ map (+1) s ++ [(\z -> z -1) w | w <- s]