# coding: utf-8

N = int(raw_input())
A = map(int, raw_input().split())

t, ans = [], 0

for i in range(len(A)):
    for j in range(i+1, len(A)):
        if sum(A[i:j+1]) == 0:
            ans += 1

print ans