import sys
from collections import Counter
import random
import numpy as np
import time

n=int(input())
a=list(map(int,input().split()))
dp=[[0 for _ in range(n)]for _ in range(n)]
dp[0][0]=a[0]
c=0
for i in range(n):
    for j in range(i+1):
        dp[i][j]=dp[i-1][j]+a[i]
        if(dp[i][j]==0):c+=1
print(c)
#for i in dp:print(i)