# -*- coding: utf-8 -*-

max_length = 10e5


N = int(input())
A = input().split()
A = [int(a) for a in A]
S = [sum(A[:i]) for i in range(N+1)]
count = 0
for i in range(N):
    for j in range(i+1, N+1):
        if S[i] == S[j]:
            count += 1
print(count, end='')
