n = int(input())
nums = input()
A =[int(x.strip()) for x in nums.split()]

S = [0]
for i in range(n):
    S.append(S[i]+A[i])

S.sort()
# print(S)

ans = 0
for i in range(n):
    for j in range(n-i):
        print(i,i+j+1)
        if S[i] == S[i+j+1]:
            ans += 1
        if S[i] < S[j+1]:
            break
print(ans)
