n = int(input())
a = list(map(int,input().split()))
s = 0
cnt = 0
m = 0
for i in range(n):
    for j in range(m,n):
        s += a[j]
        if s == 0:
            cnt += 1
    m += 1
    s = 0
print(cnt)