import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
B = np.cumsum(A)
B = B.sort()
cnt = 0
for k in range(N):
  if B[k] == B[k+1]:
    cnt += 1
  else:
    continue
print(cnt)