N = int(input())
An = list(map(int, input().split()))
Bn = []
Bn.append(0)
for i, A in enumerate(An):
    Bn.append(A+Bn[i])
ans = 0
for i in range(N+1):
    for j in range(i+1, N+1):
#         print(i, Bn[i], j, Bn[j])
        if (Bn[i] == Bn[j]):
#             print("0")
#             print(An[i:j])
            ans += 1
print(ans)
