import macros, algorithm, tables, sets, lists, queues, intsets, critbits, sequtils, strutils, math, future

proc readInt(): int =
  result = stdin.readLine.parseInt

proc readInts(): seq[int] =
  result = stdin.readLine.split.map(parseInt)

var N = readInt()
var A: seq[int]
A = readInts()

var ans = 0
for i in countup(0, N-1):
  var sum = 0
  for j in countup(i, N-1):
    sum = sum + A[j]
    if(sum == 0):
      ans += 1
    
echo ans
