import sys
from collections import Counter
import random
import time

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