import scala.collection.mutable
import scala.io.StdIn._

object Main extends App {
  val _        = readInt
  val countMap = mutable.Map[Int, Int]().withDefaultValue(0)
  readLine.split(" ").map(_.toInt).foreach(i => {
    countMap(i - 1) += 1
    countMap(i) += 1
    countMap(i + 1) += 1
  })
//  println(countMap.maxBy { case (k, v) => v })
  println(countMap.values.max)
}
