n = int(input())

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

count = 0

for i in range(n):
    skip = 0;
    for j in range(i+1,n+1):
        if skip==0:
            list = a[i:j]
        else:
            list = a[skip:j]

        if sum(list)==0:
            skip = i
            count += 1


print(count)
