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


def bf(n, a):
    cnt = 0
    for i in range(n + 1):
        for j in range(i):
            s = 0
            for k in range(j, i):
                s += a[k]
            if s == 0:
                cnt += 1
    return cnt


print(bf(n, a))
