# -*- coding: utf-8 -*-

import os
import sys

input()
nums = input().split()
answer = 0
temp = 0

for i in range(len(nums)):
    for j in nums[i:]:
        temp = temp + int(j)
        if temp == 0:
            answer = answer + 1
    temp = 0

print(answer)
