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 dp = newSeqWith(N, newSeq[int](N))
#var sum = newSeqWith(N, newSeq[int](N))
#
#if (A[0] == 0):
#  dp[0][0] = 1
#else:
#  dp[0][0] = 0
#
#for i in 0..<N:
#  for j in countdown(i, 0):
#    dp[j][i] = 
#
var ans = 0
for i in 0..<N:
  var sum = 0
  for j in i..<N:
    sum = sum + A[j]
    if(sum == 0):
      ans += 1
    
echo ans
