def slv(A):

    count = 0

    for i in range(len(A)):
        for j in range(i + 1, len(A) + 1):
            # print(A[i:j], i, j)
            if sum(A[i:j]) == 0:
                count += 1
                # print(A[i:j], i, j)
    return count


def main():
    N = int(input())
    A = list(map(int, input().split()))
    # print(A)
    print(slv(A))


if __name__ == '__main__':
    main()