import numpy as np

N = int(input())

a = np.array(list(map(int,input().split())))

a_cm = np.cumsum(a)

count = 0
for i in range(N):
    for j in range(i+1,N):
        if a_cm[j]-a_cm[i]==0:

            count += 1

    if a_cm[i] == 0:
        count +=1

print(count)