# coding : utf-8

import numpy as np

N = int(input())

A = [int(i) for i in input().split()]


count = 0

for i in range(N):
	suml = A[i]
	for j in range(i+1,N):
		suml += A[j]
		if suml == 0:
			count += 1

print(count)