
# coding: utf-8

# In[34]:


N = int(input())


# In[35]:


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


# In[36]:


counter = 0
sum = [0]
for i in range(N):
    sum.append(sum[i]+a[i])
for i in range(N):
    for k in range(i+1,N+1):
        if  sum[k]-sum[i]== 0:
            counter = counter + 1


# In[37]:


print(counter)

