# coding : utf-8
 
import numpy as np
 
N = int(input())
 
A = [int(i) for i in input().split()]

S = [0 for i in range(N+1)]

for i in range(N):
	S[i+1] = S[i] + A[i]

S = sorted(S)
cnt = 0
s = S[0]
for i in range(1,N+1):
	if s == S[i]:
		cnt += 1
	else:
		s = S[i]

#print(S)
print(cnt)