fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toLong() }
    val c = LongArray(n + 1)
    c[0] = 0L
    for (i in 1 .. n) {
        c[i] = a[i-1] + c[i - 1]
    }

    var cum = 0L
    var opNum1 = 0L
    // case (1, -1, 1, -1)
    var shouldItBe = mapOf(
        1 to 1L,
        0 to -1L
    )
    (1..n).forEach {
        val expect = shouldItBe[it % 2]!!
        val actual = c[it] + cum
        val sameOp = expect * actual > 0
        if (!sameOp) {
            val diff = expect - actual
            opNum1 += Math.abs(diff)
            cum += diff
        }
    }

    var opNum2 = 0L
    cum = 0L
    shouldItBe = mapOf(
            1 to -1L,
            0 to 1L
    )
    (1..n).forEach {
        val expect = shouldItBe[it % 2]!!
        val actual = c[it] + cum
        val sameOp = expect * actual > 0
        if (!sameOp) {
            val diff = expect - actual
            opNum2 += Math.abs(diff)
            cum += diff
        }
    }

    println(Math.min(opNum1, opNum2))
}