import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val n = sc.nextInt
  val as = Array.fill(n)(sc.nextLong)
  var count = 0
  for {
    bgn <- 0 until n
  } {
    var a = 0L
    for {
      idx <- bgn until n
    } {
      a += as(idx)
      if (a == 0) {
        count += 1
      }
    }
  }
  println(count)
}
