fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }
    val average = a.sum() / N
    println(a.sortedBy { Math.abs(it - average) + 1 }.first())
}