from itertools import accumulate

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

ans = [0]*N
for j in range(N):
    if ans[j-1] != 1:
        for i in range(j,N+1):
            if i != j:
                if sum(A[j:i]) == 0:
                    ans[i-1] = 1

print(sum(ans))
