



fun main(args:Array<String>){
    val n = readLine()!!.trim().toInt()
    val arms = Array(n){readLine()!!.trim().toLong()}.sortedDescending().toLongArray()
    var sum = 1L
    for (i in 0 until n){
        if (i / 4 < arms[i]) sum += arms[i] - i / 4
    }
    println(sum)
}
