import numpy as np
n = int(input())
a = list(map(int, input().split()))
accum = [0]*(n+1)
cnt = 0
for i in range(1, n+1):
    accum[i] = accum[i-1] + a[i-1]
    for j in range(0, i):
        if accum[i]-accum[j]==0:
            cnt += 1
print(cnt)
