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

# AtCoder Grand Contest
# Problem A


if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    count = 0

    for i in range(n):
        for j in range(i, n):
            if sum(a[i:j + 1]) == 0:
                count += 1

    print(count)
