import numpy as np
n = int(input())
a = list(map(int, input().split()))
accum = [0]*(n+1)
for i in range(1, n+1):
    accum[i] = accum[i-1] + a[i-1]
    output = np.array([1 if accum[i]-accum[j]==0 else 0 for j in range(0, i)])

print(output.nonzero()[0].size)
