fun main() {
    val n = readLine()?.toInt() ?: return
    var c = 0L
    val memo = hashMapOf<Int, Boolean>()
    repeat(n) {
        val prev = memo.getOrDefault(it - 1, false)
        var a = readLine()?.toLong() ?: return
        if (prev && a > 0) {
            c++
            a--
        }
        c += a / 2
        memo[it] = a % 2 == 1L
    }
    println(c.toString())
}
