L1 = int(input())
L2 = list(map(int,input().split(" ")))
L3 = [None]*(L1)
A = 0

def summing(length):
    s = 0
    for i in range(length):
        s += L2[i]
    return s

for i in range(L1):
    L3[i] = summing(i+1)

L3s = [0]
for i in L3:
    if i in L3s:
        A += 1
    else:
        L3s.append(i)

print(A)