package main

import "fmt"
import "bufio"
import "os"
import "strconv"
import "strings"

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	N, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	series := make([]int, N)
	for i, t := range strings.Split(sc.Text(), " ") {
		series[i], _ = strconv.Atoi(t)
	}

	count := 0
	for s := 0; s < N; s++ {
		for e := s + 1; e < N+1; e++ {
			total := 0
			for t := s; t < e; t++ {
				total += series[t]
			}
			if total == 0 {
				count++
			}
		}
	}
	fmt.Println(count)
}
