import numpy as np
x = input()
N = np.array(list(map(int, input().split())))
ans = 0
length = len(N)
for i in range(length):
    s = 0
    for j in range(i, length):
        s += N[j]
        if not s:
            ans += 1

print(ans)