import java.util.Scanner

import scala.collection.mutable

object Main extends App {
  val sc = new Scanner(System.in)
  val an = Vector.fill(sc.nextInt)(sc.nextInt)
  val map: mutable.Map[Int, Int] = mutable.Map()

  for {
    a <- an
  } yield {
    update(a - 1)
    update(a)
    update(a + 1)
  }

  val ans = map.maxBy(_._2)._2

  println(ans)

  def update(a: Int): Unit = {
    map.update(a, map.getOrElse(a, 0) + 1)
  }

}
