# -*- coding: utf-8 -*-

N = int(input())
A = list(map(int, input().split()))

counter = 0

for i in range(N):
    sumval = 0
    for j in range(i, N, 1):
        sumval += A[j]
        if(sumval == 0):
            counter += 1

print(counter)