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

# N = int(input())
# numbers = map(int, input().split())
N = 6
numbers = [1, 3, -4, 2, 2, -2]


def countSubZeroRange(numbers):
    partialSum = 0
    histogram = {}
    for number in numbers:
        partialSum += number
        histogram.setdefault(partialSum, 0)
        histogram[partialSum] += 1
    zeroSumCounts = 0
    for column in histogram:
        zeroSumCounts += column - 1
    return zeroSumCounts


print(countSubZeroRange(numbers))
