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:
            if sum(a[i:j])==0:
                skip = i
                count += 1

        else:
            if sum(a[skip:j])==0:
                skip = i
                count += 1


print(count)