N = int(input())
A = list(map(int, input().split()))
count = 0

if N == 1:
    if A[0] == 0:
        count += 1
    print(count)
else:
    count = A.count(0)
    A = [n for n in A if n != 0]
    if A == []:
        print(N)
    elif len(A) == 1:
        if A[0] == 0:
            count += 1
        print(count)
    else:
        for i in range(N):
            num = A[i]
            for Aj in A[i+1:]:
                num += Aj
                if num == 0:
                    count += 1
        print(count)