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

    val work = datA.map(a => (a, 0L)).foldLeft((0L, 0L)){ case ((sum, count),(a, _)) =>
      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 ans = work._2
    println(ans)
  }
}
