fun main(args:Array<String>) {
    val n = readLine()!!.toInt()
    val scores = readLine()!!.split(" ").map { it.toInt() }
    val cnt = mutableMapOf<Int, Int>()
    for(i in scores) {
        for(j in (i-1..i+1)) {
            if(cnt.containsKey(j)) {
                cnt[j] = cnt[j]!! + 1
            } else {
                cnt[j] = 1
            }
        }
    }
    println(cnt.maxBy { it.value }!!.value)
}
