object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val _ = readLine
    val datA = readLine.split(" ").map(_.toLong).dropWhile(_ == 0)

    def judgement(acc: (Long, Long), cur: (Long, Long)): (Long, Long) = {
      val sum = acc._1
      val count = acc._2
      val a = cur._1
      if (sum > 0) {
        if (sum + a >= 0) (-1, count + math.abs(sum + a) + 1)
        else (sum + a, count)
      }
      else if (sum < 0) {
        if (sum + a <= 0) (1, count + math.abs(sum + a) + 1)
        else (sum + a, count)
      } else {
        (a, count)
      }
    }
    val posA = datA.map(a => (a, 0L)).foldLeft((0L, 0L)){ judgement(_, _) }
    val negA = datA.tail.map(a => (a, 0L)).foldLeft(
      if(datA.head > 0) -1L else 1L, math.abs(datA.head)
    ){ judgement(_, _) }

    val ans = math.min(posA._2, negA._2)
    println(ans)
  }
}