# -*- coding: utf-8 -*-
"""
Created on Sat Apr 28 21:01:55 2018

@author: Kim
"""

N = int(input())
A = input().split()
A = [ int(x) for x in A]
n = []
New = []
ans = 0

for i in range(N):
    wa = sum(A[0:(i+1)])
    New.append(wa)
    if wa == 0:
        ans += 1

for i in range(N-1):
    maeno = A[i]

    for j in range(len(New)):
        New[j] = New[j] - maeno
    del New[0]
    for j in range(len(New)):
        if New[j] == 0:
            ans += 1
    
            
print(ans)