import random
N = int(input())
A = [int(i) for i in input().split(" ")]

matrix = [[0 for j in range(N)] for i in range(N)]
matrix[0][0] = A[0]
count = 0
for n in range(1, N):
    for j in range(0, n+1):  
        matrix[j][n] = matrix[j][n-1] + A[n]
        if matrix[j][n] == 0:
            count += 1
print(count)