package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

func main() {
  sc.Split(bufio.ScanWords)
  n := nextInt()

  var aline []int
  for i := 0; i < n; i++ {
    aline = append(aline, nextInt())
  }

  zeros := 0
  for i := 0; i < n; i++ {
    for j := 1; i+j <= n; j++ {
      line := aline[i:i+j]
      sum := 0
      for _, v := range line {
        sum += v
      }
      //fmt.Printf("i:%v j:%v line:%v sum:%v\n", i, j, line, sum)
      if sum == 0 {
        zeros += 1
      }
    }
  }

	fmt.Printf("%v\n", zeros)
}